0. Import packages¶

First, we import the necessary packages for this exercise.

In [1]:
import xarray as xr 
import matplotlib.pyplot as plt 
import cartopy.crs as ccrs
from datetime import datetime, timedelta
import numpy as np
import cartopy.feature as cfeature

%matplotlib inline
In [2]:
# Change to directory where data is stored
data_dir = "../data" # "/kyukon/data/gent/courses/2024/computphys_C004504/input"

1. Open simulation data¶

  • Open the 2-meter temperature (variable tas) data for the initSFX-simulation starting at midnight on 1 July 2019 and running for 720 hours: initSFX_2019070100_720_tas_2019-07-01T01_2019-07-31T00_3600_regridded.nc
  • Which units are used for the temperature? Convert these units to degrees Celsius (if necessary) for this exercise. This will facilitate the interpretation of results.
  • Let's now focus on one location: the Royal Meteorological Institute of Belgium (RMI) in Uccle. Select the temperature data for this location from the simulation dataset. Do so by finding the point in the simulation grid, which lies closest to the RMI. The coordinates of the RMI are 50.799 N, 4.359 E.
  • From 22 until 26 July 2019, we experienced a short, but very intense heat wave in Belgium. The RMI speaks of a heat wave when the maximum temperatures in Uccle reach at least 25 degrees for at least 5 consecutive days, with at least 30 degrees being reached on at least three days (see heat wave definition in Dutch). Select this 5-day period from the data and verify if these conditions for a heat wave are met in the simulation data by inspecting a plot.

Solutions:¶

We will write a function for loading in the data and converting temperature variables to degrees Celsius.

In [3]:
def convert_to_Celsius(ds):
    for var_name in ["tas", "ts", "tsl1", "tsl2", "troad1"]:
        if var_name in ds:
            ds[var_name].values = ds[var_name].values - 273.15
            ds[var_name].attrs["units"] = "°C"

    return ds

def open_data(data_dir, var_name_list, run_name_list):

    ds_list_list = list()
    ds_land_use_list = list()

    for run_name in run_name_list:
        ds_list = list()

        for var_name in var_name_list:
            ds = xr.open_dataset(f"{data_dir}/{run_name}_2019070100_720_{var_name}_2019-07-01T01_2019-07-31T00_3600_regridded.nc", engine="netcdf4")
            ds_list.append(ds)

        ds = xr.merge(ds_list, compat="minimal")
        ds_list_list.append(ds)

        ds_land_use = xr.open_dataset(f"{data_dir}/{run_name}_landuse_regridded.nc", engine="netcdf4", chunks="auto")
        ds_land_use_list.append(ds_land_use)

    ds = xr.concat(ds_list_list, dim="run_name")
    ds_land_use = xr.concat(ds_land_use_list, dim="run_name")

    ds = xr.merge([ds, ds_land_use])
    ds = convert_to_Celsius(ds)
    
    return ds
In [4]:
var_name_list = ["tas"]
run_name_list = ["initSFX"]

ds = open_data(data_dir, var_name_list, run_name_list)
ds
Out[4]:
<xarray.Dataset>
Dimensions:      (time: 720, lon: 75, lat: 70, run_name: 1, bnds: 2)
Coordinates:
  * time         (time) datetime64[ns] 2019-07-01T01:00:00 ... 2019-07-31
  * lon          (lon) float64 2.0 2.07 2.14 2.21 2.28 ... 6.97 7.04 7.11 7.18
  * lat          (lat) float64 49.0 49.05 49.09 49.13 ... 51.97 52.02 52.06 52.1
    time_bnds    (time, bnds) datetime64[ns] ...
    height       float64 ...
    crs          int64 ...
    rstart       <U10 ...
  * run_name     (run_name) <U7 'initSFX'
Dimensions without coordinates: bnds
Data variables:
    tas          (run_name, time, lat, lon) float32 16.69 17.13 ... 22.42 22.4
    frac_town    (run_name, lat, lon) float32 dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
    frac_water   (run_name, lat, lon) float32 dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
    frac_nature  (run_name, lat, lon) float32 dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
    frac_sea     (run_name, lat, lon) float32 dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
Attributes: (12/33)
    CDI:                       Climate Data Interface version 2.0.6 (https://...
    source:                    ALARO-1 (CY43T2) - SURFEX v8.0
    Conventions:               CF-1.11
    activity_id:               DD
    comment:                   
    contact:                   wout.dewettinck@ugent.be
    ...                        ...
    version_realization_info:  
    creation_date:             2024-11-12T10:18:38Z
    frequency:                 1hr
    StartTime:                 2019-07-01T00:00
    EndTime:                   2019-07-31T00:00
    CDO:                       Climate Data Operators version 2.0.6 (https://...
xarray.Dataset
    • time: 720
    • lon: 75
    • lat: 70
    • run_name: 1
    • bnds: 2
    • time
      (time)
      datetime64[ns]
      2019-07-01T01:00:00 ... 2019-07-31
      axis :
      T
      standard_name :
      time
      long_name :
      time
      bounds :
      time_bnds
      array(['2019-07-01T01:00:00.000000000', '2019-07-01T02:00:00.000000000',
             '2019-07-01T03:00:00.000000000', ..., '2019-07-30T22:00:00.000000000',
             '2019-07-30T23:00:00.000000000', '2019-07-31T00:00:00.000000000'],
            dtype='datetime64[ns]')
    • lon
      (lon)
      float64
      2.0 2.07 2.14 ... 7.04 7.11 7.18
      standard_name :
      longitude
      long_name :
      longitude
      units :
      degrees_east
      axis :
      X
      array([2.  , 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7 , 2.77,
             2.84, 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4 , 3.47, 3.54, 3.61,
             3.68, 3.75, 3.82, 3.89, 3.96, 4.03, 4.1 , 4.17, 4.24, 4.31, 4.38, 4.45,
             4.52, 4.59, 4.66, 4.73, 4.8 , 4.87, 4.94, 5.01, 5.08, 5.15, 5.22, 5.29,
             5.36, 5.43, 5.5 , 5.57, 5.64, 5.71, 5.78, 5.85, 5.92, 5.99, 6.06, 6.13,
             6.2 , 6.27, 6.34, 6.41, 6.48, 6.55, 6.62, 6.69, 6.76, 6.83, 6.9 , 6.97,
             7.04, 7.11, 7.18])
    • lat
      (lat)
      float64
      49.0 49.05 49.09 ... 52.06 52.1
      standard_name :
      latitude
      long_name :
      latitude
      units :
      degrees_north
      axis :
      Y
      array([49.   , 49.045, 49.09 , 49.135, 49.18 , 49.225, 49.27 , 49.315, 49.36 ,
             49.405, 49.45 , 49.495, 49.54 , 49.585, 49.63 , 49.675, 49.72 , 49.765,
             49.81 , 49.855, 49.9  , 49.945, 49.99 , 50.035, 50.08 , 50.125, 50.17 ,
             50.215, 50.26 , 50.305, 50.35 , 50.395, 50.44 , 50.485, 50.53 , 50.575,
             50.62 , 50.665, 50.71 , 50.755, 50.8  , 50.845, 50.89 , 50.935, 50.98 ,
             51.025, 51.07 , 51.115, 51.16 , 51.205, 51.25 , 51.295, 51.34 , 51.385,
             51.43 , 51.475, 51.52 , 51.565, 51.61 , 51.655, 51.7  , 51.745, 51.79 ,
             51.835, 51.88 , 51.925, 51.97 , 52.015, 52.06 , 52.105])
    • time_bnds
      (time, bnds)
      datetime64[ns]
      ...
      [1440 values with dtype=datetime64[ns]]
    • height
      ()
      float64
      ...
      long_name :
      height
      standard_name :
      height
      units :
      m
      positive :
      up
      axis :
      Z
      [1 values with dtype=float64]
    • crs
      ()
      int64
      ...
      grid_mapping_name :
      lambert_conformal_conic
      standard_parallel :
      [51.07 51.07]
      latitude_of_projection_origin :
      0.0
      longitude_of_central_meridian :
      3.6999999999999993
      earth_radius :
      6371229.0
      [1 values with dtype=int64]
    • rstart
      ()
      <U10
      ...
      [1 values with dtype=<U10]
    • run_name
      (run_name)
      <U7
      'initSFX'
      array(['initSFX'], dtype='<U7')
    • tas
      (run_name, time, lat, lon)
      float32
      16.69 17.13 17.26 ... 22.42 22.4
      standard_name :
      air_temperature
      long_name :
      Near-Surface Air Temperature
      units :
      °C
      cell_methods :
      time: point
      array([[[[16.689758 , 17.130737 , 17.258179 , ..., 23.617859 ,
                23.367676 , 23.06137  ],
               [16.265503 , 16.897247 , 17.088898 , ..., 23.565582 ,
                23.422089 , 22.996948 ],
               [16.014618 , 16.34909  , 16.50589  , ..., 23.578918 ,
                23.477478 , 22.938324 ],
               ...,
               [16.761353 , 16.759827 , 16.738861 , ..., 18.397034 ,
                18.274353 , 18.042725 ],
               [16.733032 , 16.713226 , 16.687042 , ..., 18.30542  ,
                18.21997  , 17.995758 ],
               [16.685211 , 16.688507 , 16.67929  , ..., 18.1333   ,
                18.119476 , 17.96817  ]],
      
              [[16.259186 , 16.639343 , 16.743011 , ..., 23.285156 ,
                23.087067 , 22.789215 ],
               [15.856934 , 16.411682 , 16.588379 , ..., 23.17511  ,
                23.098724 , 22.736603 ],
               [15.647827 , 15.921112 , 16.055298 , ..., 23.14624  ,
                23.12967  , 22.694824 ],
      ...
               [16.216095 , 16.11905  , 16.016815 , ..., 22.767761 ,
                22.76004  , 22.804413 ],
               [16.22992  , 16.114288 , 16.006195 , ..., 22.835266 ,
                22.770569 , 22.79718  ],
               [16.244781 , 16.13913  , 16.041107 , ..., 22.972412 ,
                22.88916  , 22.815887 ]],
      
              [[15.33606  , 15.695007 , 15.769745 , ..., 18.748108 ,
                18.754639 , 18.856812 ],
               [15.235565 , 15.6701355, 15.754608 , ..., 18.619995 ,
                18.09726  , 18.267365 ],
               [15.099701 , 15.290375 , 15.346985 , ..., 18.702698 ,
                17.97232  , 17.861328 ],
               ...,
               [16.31543  , 16.203125 , 16.089508 , ..., 22.223145 ,
                22.257202 , 22.303864 ],
               [16.326172 , 16.196716 , 16.081085 , ..., 22.256073 ,
                22.297394 , 22.34018  ],
               [16.338715 , 16.219025 , 16.1167   , ..., 22.320404 ,
                22.42212  , 22.40445  ]]]], dtype=float32)
    • frac_town
      (run_name, lat, lon)
      float32
      dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
      standard_name :
      town_fraction
      long_name :
      Town Fraction
      units :
      %
      Array Chunk
      Bytes 20.51 kiB 20.51 kiB
      Shape (1, 70, 75) (1, 70, 75)
      Dask graph 1 chunks in 3 graph layers
      Data type float32 numpy.ndarray
      75 70 1
    • frac_water
      (run_name, lat, lon)
      float32
      dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
      standard_name :
      water_fraction
      long_name :
      Water Fraction
      units :
      %
      Array Chunk
      Bytes 20.51 kiB 20.51 kiB
      Shape (1, 70, 75) (1, 70, 75)
      Dask graph 1 chunks in 3 graph layers
      Data type float32 numpy.ndarray
      75 70 1
    • frac_nature
      (run_name, lat, lon)
      float32
      dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
      standard_name :
      nature_fraction
      long_name :
      Nature Fraction
      units :
      %
      Array Chunk
      Bytes 20.51 kiB 20.51 kiB
      Shape (1, 70, 75) (1, 70, 75)
      Dask graph 1 chunks in 3 graph layers
      Data type float32 numpy.ndarray
      75 70 1
    • frac_sea
      (run_name, lat, lon)
      float32
      dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
      standard_name :
      sea_fraction
      long_name :
      Sea Fraction
      units :
      %
      Array Chunk
      Bytes 20.51 kiB 20.51 kiB
      Shape (1, 70, 75) (1, 70, 75)
      Dask graph 1 chunks in 3 graph layers
      Data type float32 numpy.ndarray
      75 70 1
    • time
      PandasIndex
      PandasIndex(DatetimeIndex(['2019-07-01 01:00:00', '2019-07-01 02:00:00',
                     '2019-07-01 03:00:00', '2019-07-01 04:00:00',
                     '2019-07-01 05:00:00', '2019-07-01 06:00:00',
                     '2019-07-01 07:00:00', '2019-07-01 08:00:00',
                     '2019-07-01 09:00:00', '2019-07-01 10:00:00',
                     ...
                     '2019-07-30 15:00:00', '2019-07-30 16:00:00',
                     '2019-07-30 17:00:00', '2019-07-30 18:00:00',
                     '2019-07-30 19:00:00', '2019-07-30 20:00:00',
                     '2019-07-30 21:00:00', '2019-07-30 22:00:00',
                     '2019-07-30 23:00:00', '2019-07-31 00:00:00'],
                    dtype='datetime64[ns]', name='time', length=720, freq=None))
    • lon
      PandasIndex
      PandasIndex(Index([               2.0,               2.07,               2.14,
                           2.21, 2.2800000000000002,               2.35,
                           2.42,               2.49,               2.56,
                           2.63,                2.7,               2.77,
                           2.84,               2.91,               2.98,
             3.0500000000000003,               3.12,               3.19,
             3.2600000000000002,               3.33, 3.4000000000000004,
                           3.47,               3.54, 3.6100000000000003,
                           3.68,               3.75, 3.8200000000000003,
                           3.89,               3.96,               4.03,
             4.1000000000000005,               4.17,               4.24,
             4.3100000000000005,               4.38,               4.45,
             4.5200000000000005,               4.59,               4.66,
                           4.73,  4.800000000000001,               4.87,
                           4.94,  5.010000000000001,               5.08,
                           5.15,  5.220000000000001,               5.29,
                           5.36,  5.430000000000001,                5.5,
                           5.57,  5.640000000000001,               5.71,
                           5.78, 5.8500000000000005,               5.92,
                           5.99, 6.0600000000000005,  6.130000000000001,
                            6.2, 6.2700000000000005,  6.340000000000001,
                           6.41,               6.48,  6.550000000000001,
                           6.62,               6.69,  6.760000000000001,
                           6.83,                6.9,  6.970000000000001,
              7.040000000000001,               7.11,  7.180000000000001],
            dtype='float64', name='lon'))
    • lat
      PandasIndex
      PandasIndex(Index([  49.0, 49.045,  49.09, 49.135,  49.18, 49.225,  49.27, 49.315,  49.36,
             49.405,  49.45, 49.495,  49.54, 49.585,  49.63, 49.675,  49.72, 49.765,
              49.81, 49.855,   49.9, 49.945,  49.99, 50.035,  50.08, 50.125,  50.17,
             50.215,  50.26, 50.305,  50.35, 50.395,  50.44, 50.485,  50.53, 50.575,
              50.62, 50.665,  50.71, 50.755,   50.8, 50.845,  50.89, 50.935,  50.98,
             51.025,  51.07, 51.115,  51.16, 51.205,  51.25, 51.295,  51.34, 51.385,
              51.43, 51.475,  51.52, 51.565,  51.61, 51.655,   51.7, 51.745,  51.79,
             51.835,  51.88, 51.925,  51.97, 52.015,  52.06, 52.105],
            dtype='float64', name='lat'))
    • run_name
      PandasIndex
      PandasIndex(Index(['initSFX'], dtype='object', name='run_name'))
  • CDI :
    Climate Data Interface version 2.0.6 (https://mpimet.mpg.de/cdi)
    source :
    ALARO-1 (CY43T2) - SURFEX v8.0
    Conventions :
    CF-1.11
    activity_id :
    DD
    comment :
    contact :
    wout.dewettinck@ugent.be
    domain :
    domain_id :
    driving_experiment :
    reanalysis simulation of the recent past
    driving_experiment_id :
    evaluation
    driving_institution_id :
    ECMWF
    driving_source_id :
    ERA5
    driving_variant_label :
    r1i1p1f1
    grid :
    Lambert conic conformal with 1.3 km grid spacing
    history :
    Tue Nov 12 11:30:52 2024: cdo -v remapcon,/dodrio/scratch/users/vsc45263/wout/CompPhys/simulations/src/grids/belgium_5km_latlon.txt initSFX_2019070100_720_tas_2019-07-01T01_2019-07-31T00_3600.nc initSFX_2019070100_720_tas_2019-07-01T01_2019-07-31T00_3600_regridded.nc
    institution :
    institution_id :
    license :
    https://cordex.org/data-access/cordex-cmip6-data/cordex-cmip6-terms-of-use
    mip_era :
    CMIP6
    product :
    model-output
    project_id :
    CORDEX
    references :
    source_id :
    source_type :
    ARCM
    tracking_id :
    variable_id :
    tas
    version_realization :
    v1-r1
    version_realization_info :
    creation_date :
    2024-11-12T10:18:38Z
    frequency :
    1hr
    StartTime :
    2019-07-01T00:00
    EndTime :
    2019-07-31T00:00
    CDO :
    Climate Data Operators version 2.0.6 (https://mpimet.mpg.de/cdo)
In [5]:
lat_rmi, lon_rmi = 50.799, 4.359
ds_rmi = ds.sel(lon=lon_rmi, lat=lat_rmi, method="nearest")
ds_rmi
Out[5]:
<xarray.Dataset>
Dimensions:      (time: 720, run_name: 1, bnds: 2)
Coordinates:
  * time         (time) datetime64[ns] 2019-07-01T01:00:00 ... 2019-07-31
    lon          float64 4.38
    lat          float64 50.8
    time_bnds    (time, bnds) datetime64[ns] ...
    height       float64 ...
    crs          int64 ...
    rstart       <U10 ...
  * run_name     (run_name) <U7 'initSFX'
Dimensions without coordinates: bnds
Data variables:
    tas          (run_name, time) float32 16.88 16.61 16.42 ... 17.18 16.59
    frac_town    (run_name) float32 dask.array<chunksize=(1,), meta=np.ndarray>
    frac_water   (run_name) float32 dask.array<chunksize=(1,), meta=np.ndarray>
    frac_nature  (run_name) float32 dask.array<chunksize=(1,), meta=np.ndarray>
    frac_sea     (run_name) float32 dask.array<chunksize=(1,), meta=np.ndarray>
Attributes: (12/33)
    CDI:                       Climate Data Interface version 2.0.6 (https://...
    source:                    ALARO-1 (CY43T2) - SURFEX v8.0
    Conventions:               CF-1.11
    activity_id:               DD
    comment:                   
    contact:                   wout.dewettinck@ugent.be
    ...                        ...
    version_realization_info:  
    creation_date:             2024-11-12T10:18:38Z
    frequency:                 1hr
    StartTime:                 2019-07-01T00:00
    EndTime:                   2019-07-31T00:00
    CDO:                       Climate Data Operators version 2.0.6 (https://...
xarray.Dataset
    • time: 720
    • run_name: 1
    • bnds: 2
    • time
      (time)
      datetime64[ns]
      2019-07-01T01:00:00 ... 2019-07-31
      axis :
      T
      standard_name :
      time
      long_name :
      time
      bounds :
      time_bnds
      array(['2019-07-01T01:00:00.000000000', '2019-07-01T02:00:00.000000000',
             '2019-07-01T03:00:00.000000000', ..., '2019-07-30T22:00:00.000000000',
             '2019-07-30T23:00:00.000000000', '2019-07-31T00:00:00.000000000'],
            dtype='datetime64[ns]')
    • lon
      ()
      float64
      4.38
      standard_name :
      longitude
      long_name :
      longitude
      units :
      degrees_east
      axis :
      X
      array(4.38)
    • lat
      ()
      float64
      50.8
      standard_name :
      latitude
      long_name :
      latitude
      units :
      degrees_north
      axis :
      Y
      array(50.8)
    • time_bnds
      (time, bnds)
      datetime64[ns]
      ...
      [1440 values with dtype=datetime64[ns]]
    • height
      ()
      float64
      ...
      long_name :
      height
      standard_name :
      height
      units :
      m
      positive :
      up
      axis :
      Z
      [1 values with dtype=float64]
    • crs
      ()
      int64
      ...
      grid_mapping_name :
      lambert_conformal_conic
      standard_parallel :
      [51.07 51.07]
      latitude_of_projection_origin :
      0.0
      longitude_of_central_meridian :
      3.6999999999999993
      earth_radius :
      6371229.0
      [1 values with dtype=int64]
    • rstart
      ()
      <U10
      ...
      [1 values with dtype=<U10]
    • run_name
      (run_name)
      <U7
      'initSFX'
      array(['initSFX'], dtype='<U7')
    • tas
      (run_name, time)
      float32
      16.88 16.61 16.42 ... 17.18 16.59
      standard_name :
      air_temperature
      long_name :
      Near-Surface Air Temperature
      units :
      °C
      cell_methods :
      time: point
      array([[16.877777 , 16.605377 , 16.415771 , 16.282715 , 16.668823 ,
              17.80658  , 19.115204 , 20.465149 , 21.860016 , 23.210968 ,
              24.322601 , 25.290833 , 26.256134 , 26.528229 , 26.715881 ,
              25.536835 , 24.015472 , 22.432953 , 21.108368 , 19.90387  ,
              18.946716 , 17.920898 , 17.242035 , 16.622925 , 16.190247 ,
              15.696289 , 15.142914 , 14.702026 , 15.454498 , 16.848999 ,
              18.163025 , 19.89975  , 21.420715 , 22.428131 , 23.376678 ,
              24.072906 , 24.500916 , 25.116425 , 25.369171 , 25.141418 ,
              24.383362 , 22.75055  , 21.287567 , 19.914368 , 18.580658 ,
              17.363434 , 16.570343 , 15.94632  , 15.305542 , 14.68161  ,
              14.145752 , 13.644226 , 13.573151 , 14.282196 , 15.834595 ,
              17.615814 , 19.2901   , 20.642914 , 22.065338 , 23.145996 ,
              24.022583 , 24.36789  , 24.001007 , 23.224884 , 23.24118  ,
              22.278198 , 20.81186  , 18.871216 , 17.19983  , 15.893005 ,
              14.83429  , 14.030945 , 13.24176  , 12.513702 , 11.889862 ,
              11.412323 , 11.825073 , 13.332581 , 15.425201 , 17.698303 ,
              19.855682 , 21.773895 , 23.44281  , 24.977264 , 25.925293 ,
              26.695251 , 27.026825 , 27.235657 , 26.659729 , 25.929626 ,
              24.224792 , 21.675232 , 20.048462 , 19.024048 , 18.245209 ,
              17.539917 , 16.998749 , 16.458221 , 16.005402 , 15.650726 ,
      ...
              19.83606  , 19.164368 , 18.960846 , 19.03955  , 19.496552 ,
              20.48462  , 21.652374 , 22.700775 , 24.02362  , 25.232422 ,
              25.707642 , 25.358246 , 26.331635 , 25.24057  , 24.831726 ,
              23.677338 , 22.381592 , 21.216766 , 20.240417 , 19.67804  ,
              19.212341 , 18.860992 , 18.694366 , 18.385254 , 17.439148 ,
              17.358337 , 17.420319 , 17.47998  , 17.668396 , 17.959045 ,
              18.072906 , 18.828735 , 19.718567 , 20.083496 , 21.103302 ,
              21.86444  , 21.967712 , 20.883423 , 20.076477 , 20.232697 ,
              18.734802 , 18.073761 , 17.676025 , 17.136963 , 16.751953 ,
              16.373688 , 15.904755 , 15.42691  , 14.875427 , 14.287048 ,
              13.835968 , 13.832184 , 15.063721 , 16.941559 , 18.775543 ,
              20.815308 , 23.123322 , 25.50879  , 27.00821  , 27.828552 ,
              28.21643  , 28.073853 , 27.930176 , 27.516235 , 26.719513 ,
              25.660492 , 23.746185 , 22.183105 , 21.004547 , 20.007233 ,
              19.331726 , 18.831848 , 18.424805 , 18.530457 , 18.661377 ,
              18.79419  , 20.464752 , 22.559937 , 24.22229  , 26.003845 ,
              25.892303 , 26.02301  , 25.060059 , 26.447327 , 27.392578 ,
              27.883911 , 27.10321  , 26.294037 , 25.177734 , 23.022827 ,
              21.931885 , 17.994202 , 17.211426 , 17.17511  , 16.593933 ]],
            dtype=float32)
    • frac_town
      (run_name)
      float32
      dask.array<chunksize=(1,), meta=np.ndarray>
      standard_name :
      town_fraction
      long_name :
      Town Fraction
      units :
      %
      Array Chunk
      Bytes 4 B 4 B
      Shape (1,) (1,)
      Dask graph 1 chunks in 4 graph layers
      Data type float32 numpy.ndarray
      1 1
    • frac_water
      (run_name)
      float32
      dask.array<chunksize=(1,), meta=np.ndarray>
      standard_name :
      water_fraction
      long_name :
      Water Fraction
      units :
      %
      Array Chunk
      Bytes 4 B 4 B
      Shape (1,) (1,)
      Dask graph 1 chunks in 4 graph layers
      Data type float32 numpy.ndarray
      1 1
    • frac_nature
      (run_name)
      float32
      dask.array<chunksize=(1,), meta=np.ndarray>
      standard_name :
      nature_fraction
      long_name :
      Nature Fraction
      units :
      %
      Array Chunk
      Bytes 4 B 4 B
      Shape (1,) (1,)
      Dask graph 1 chunks in 4 graph layers
      Data type float32 numpy.ndarray
      1 1
    • frac_sea
      (run_name)
      float32
      dask.array<chunksize=(1,), meta=np.ndarray>
      standard_name :
      sea_fraction
      long_name :
      Sea Fraction
      units :
      %
      Array Chunk
      Bytes 4 B 4 B
      Shape (1,) (1,)
      Dask graph 1 chunks in 4 graph layers
      Data type float32 numpy.ndarray
      1 1
    • time
      PandasIndex
      PandasIndex(DatetimeIndex(['2019-07-01 01:00:00', '2019-07-01 02:00:00',
                     '2019-07-01 03:00:00', '2019-07-01 04:00:00',
                     '2019-07-01 05:00:00', '2019-07-01 06:00:00',
                     '2019-07-01 07:00:00', '2019-07-01 08:00:00',
                     '2019-07-01 09:00:00', '2019-07-01 10:00:00',
                     ...
                     '2019-07-30 15:00:00', '2019-07-30 16:00:00',
                     '2019-07-30 17:00:00', '2019-07-30 18:00:00',
                     '2019-07-30 19:00:00', '2019-07-30 20:00:00',
                     '2019-07-30 21:00:00', '2019-07-30 22:00:00',
                     '2019-07-30 23:00:00', '2019-07-31 00:00:00'],
                    dtype='datetime64[ns]', name='time', length=720, freq=None))
    • run_name
      PandasIndex
      PandasIndex(Index(['initSFX'], dtype='object', name='run_name'))
  • CDI :
    Climate Data Interface version 2.0.6 (https://mpimet.mpg.de/cdi)
    source :
    ALARO-1 (CY43T2) - SURFEX v8.0
    Conventions :
    CF-1.11
    activity_id :
    DD
    comment :
    contact :
    wout.dewettinck@ugent.be
    domain :
    domain_id :
    driving_experiment :
    reanalysis simulation of the recent past
    driving_experiment_id :
    evaluation
    driving_institution_id :
    ECMWF
    driving_source_id :
    ERA5
    driving_variant_label :
    r1i1p1f1
    grid :
    Lambert conic conformal with 1.3 km grid spacing
    history :
    Tue Nov 12 11:30:52 2024: cdo -v remapcon,/dodrio/scratch/users/vsc45263/wout/CompPhys/simulations/src/grids/belgium_5km_latlon.txt initSFX_2019070100_720_tas_2019-07-01T01_2019-07-31T00_3600.nc initSFX_2019070100_720_tas_2019-07-01T01_2019-07-31T00_3600_regridded.nc
    institution :
    institution_id :
    license :
    https://cordex.org/data-access/cordex-cmip6-data/cordex-cmip6-terms-of-use
    mip_era :
    CMIP6
    product :
    model-output
    project_id :
    CORDEX
    references :
    source_id :
    source_type :
    ARCM
    tracking_id :
    variable_id :
    tas
    version_realization :
    v1-r1
    version_realization_info :
    creation_date :
    2024-11-12T10:18:38Z
    frequency :
    1hr
    StartTime :
    2019-07-01T00:00
    EndTime :
    2019-07-31T00:00
    CDO :
    Climate Data Operators version 2.0.6 (https://mpimet.mpg.de/cdo)
In [6]:
# Change this to period of heat wave
tstart = "2019-07-22T01"
tstop = "2019-07-27T00"
var_name = "tas"
run_name = "initSFX"
ds_rmi_period = ds_rmi.sel(time=slice(tstart, tstop), run_name=run_name)

### Temperatures

fig, ax = plt.subplots(figsize=(6.4, 4.8), layout="constrained")

var = ds_rmi_period[var_name]
long_name = var.attrs["long_name"]
var.plot(ax=ax, x="time", label=run_name)

ax.set_title(f"Temperature in Uccle\nbetween {tstart} and {tstop}")
ax.axhline(25, linestyle="--", color="grey", label="T = 25°C")
ax.axhline(30, linestyle="--", color="black", label="T = 30°C")
ax.legend()

plt.show()
No description has been provided for this image

This five-day period just qualifies as a heat wave.

2. Investigate UHI¶

In this next part of the practical, we will investigate the Urban Heat Island (UHI) in the simulations. We will do so by comparing the simulation to the MOCCA observational network. This network consists of 6 stations located in the city of Ghent. Each station is placed in a different urban environment, to gauge the influence of this environment on the micro-climate. One of these stations is located outside of the city, in Melle, and can be considered a rural station. We can define the UHI intensity by calculating the temperature difference between an urban and a rural station. This difference in temperature depends on the time of day. Therefore, the UHI is often studied by computing a so-called diurnal (or daily) cycle. This diurnal cycle is constructed by taking an average of the data over a certain period for each hour of the day. For example, all the data at midnight are averaged together, the data at 1:00, ... This diurnal cycle represents the variations throughout the day.

For this exercise, we will work with the tas-variable from the initSFX-simulation from 1 July 2019 (720 hours). We will also need the land use information stored in initSFX_landuse_regridded.nc.

  • Load in the MOCCA station data for the period of the heat wave. These data are stored in the file MOCCA_tas_2019-07-22T01_2019-07-27T00.nc. Explore the data.
  • We will now consider these locations in the simulation data. Select the points in the simulation data which are closest to each of the stations. Assign coordinates so that you get an xarray DataSet with the same dimensions as the observations: (time, locations)
  • For each of the locations, consider the town fraction. Select the locations with the lowest and highest town fraction from the stations. We will use these to represent rural and urban locations respectively.
  • For the period of the heat wave (22-26 July 2019), calculate the diurnal cycle of temperature for both locations for the simulation data. Plot the difference between the urban and rural diurnal cycles. Is a urban heat island present in the simulations? What is the UHI intensity? At what hours of the day is it the highest?
  • Repeat the previous step for the observational data. Compare this result with the simulation data.
  • Where does the difference in UHI intensity between the simulation and observations come from? Plot the bias of the diurnal cycle in temperature for both locations. Link the difference in UHI between the simulation and observations to the bias at the urban and rural locations.

Solutions:¶

In [7]:
tstart = "2019-07-22T01"
tstop = "2019-07-27T00"
obs = xr.open_dataset(f"{data_dir}/MOCCA_tas_{tstart}_{tstop}.nc", engine="netcdf4")
obs
Out[7]:
<xarray.Dataset>
Dimensions:   (time: 120, location: 6)
Coordinates:
    index     (time) int64 ...
    year      (time) int64 ...
    month     (time) int64 ...
    day       (time) int64 ...
    hour      (time) int64 ...
  * time      (time) datetime64[ns] 2019-07-22T01:00:00 ... 2019-07-27
    lon       (location) float64 ...
    lat       (location) float64 ...
  * location  (location) <U13 'Provinciehuis' 'Melle' ... 'Sint-Bavo'
Data variables:
    tas       (location, time) float64 ...
xarray.Dataset
    • time: 120
    • location: 6
    • index
      (time)
      int64
      ...
      [120 values with dtype=int64]
    • year
      (time)
      int64
      ...
      [120 values with dtype=int64]
    • month
      (time)
      int64
      ...
      [120 values with dtype=int64]
    • day
      (time)
      int64
      ...
      [120 values with dtype=int64]
    • hour
      (time)
      int64
      ...
      [120 values with dtype=int64]
    • time
      (time)
      datetime64[ns]
      2019-07-22T01:00:00 ... 2019-07-27
      array(['2019-07-22T01:00:00.000000000', '2019-07-22T02:00:00.000000000',
             '2019-07-22T03:00:00.000000000', '2019-07-22T04:00:00.000000000',
             '2019-07-22T05:00:00.000000000', '2019-07-22T06:00:00.000000000',
             '2019-07-22T07:00:00.000000000', '2019-07-22T08:00:00.000000000',
             '2019-07-22T09:00:00.000000000', '2019-07-22T10:00:00.000000000',
             '2019-07-22T11:00:00.000000000', '2019-07-22T12:00:00.000000000',
             '2019-07-22T13:00:00.000000000', '2019-07-22T14:00:00.000000000',
             '2019-07-22T15:00:00.000000000', '2019-07-22T16:00:00.000000000',
             '2019-07-22T17:00:00.000000000', '2019-07-22T18:00:00.000000000',
             '2019-07-22T19:00:00.000000000', '2019-07-22T20:00:00.000000000',
             '2019-07-22T21:00:00.000000000', '2019-07-22T22:00:00.000000000',
             '2019-07-22T23:00:00.000000000', '2019-07-23T00:00:00.000000000',
             '2019-07-23T01:00:00.000000000', '2019-07-23T02:00:00.000000000',
             '2019-07-23T03:00:00.000000000', '2019-07-23T04:00:00.000000000',
             '2019-07-23T05:00:00.000000000', '2019-07-23T06:00:00.000000000',
             '2019-07-23T07:00:00.000000000', '2019-07-23T08:00:00.000000000',
             '2019-07-23T09:00:00.000000000', '2019-07-23T10:00:00.000000000',
             '2019-07-23T11:00:00.000000000', '2019-07-23T12:00:00.000000000',
             '2019-07-23T13:00:00.000000000', '2019-07-23T14:00:00.000000000',
             '2019-07-23T15:00:00.000000000', '2019-07-23T16:00:00.000000000',
             '2019-07-23T17:00:00.000000000', '2019-07-23T18:00:00.000000000',
             '2019-07-23T19:00:00.000000000', '2019-07-23T20:00:00.000000000',
             '2019-07-23T21:00:00.000000000', '2019-07-23T22:00:00.000000000',
             '2019-07-23T23:00:00.000000000', '2019-07-24T00:00:00.000000000',
             '2019-07-24T01:00:00.000000000', '2019-07-24T02:00:00.000000000',
             '2019-07-24T03:00:00.000000000', '2019-07-24T04:00:00.000000000',
             '2019-07-24T05:00:00.000000000', '2019-07-24T06:00:00.000000000',
             '2019-07-24T07:00:00.000000000', '2019-07-24T08:00:00.000000000',
             '2019-07-24T09:00:00.000000000', '2019-07-24T10:00:00.000000000',
             '2019-07-24T11:00:00.000000000', '2019-07-24T12:00:00.000000000',
             '2019-07-24T13:00:00.000000000', '2019-07-24T14:00:00.000000000',
             '2019-07-24T15:00:00.000000000', '2019-07-24T16:00:00.000000000',
             '2019-07-24T17:00:00.000000000', '2019-07-24T18:00:00.000000000',
             '2019-07-24T19:00:00.000000000', '2019-07-24T20:00:00.000000000',
             '2019-07-24T21:00:00.000000000', '2019-07-24T22:00:00.000000000',
             '2019-07-24T23:00:00.000000000', '2019-07-25T00:00:00.000000000',
             '2019-07-25T01:00:00.000000000', '2019-07-25T02:00:00.000000000',
             '2019-07-25T03:00:00.000000000', '2019-07-25T04:00:00.000000000',
             '2019-07-25T05:00:00.000000000', '2019-07-25T06:00:00.000000000',
             '2019-07-25T07:00:00.000000000', '2019-07-25T08:00:00.000000000',
             '2019-07-25T09:00:00.000000000', '2019-07-25T10:00:00.000000000',
             '2019-07-25T11:00:00.000000000', '2019-07-25T12:00:00.000000000',
             '2019-07-25T13:00:00.000000000', '2019-07-25T14:00:00.000000000',
             '2019-07-25T15:00:00.000000000', '2019-07-25T16:00:00.000000000',
             '2019-07-25T17:00:00.000000000', '2019-07-25T18:00:00.000000000',
             '2019-07-25T19:00:00.000000000', '2019-07-25T20:00:00.000000000',
             '2019-07-25T21:00:00.000000000', '2019-07-25T22:00:00.000000000',
             '2019-07-25T23:00:00.000000000', '2019-07-26T00:00:00.000000000',
             '2019-07-26T01:00:00.000000000', '2019-07-26T02:00:00.000000000',
             '2019-07-26T03:00:00.000000000', '2019-07-26T04:00:00.000000000',
             '2019-07-26T05:00:00.000000000', '2019-07-26T06:00:00.000000000',
             '2019-07-26T07:00:00.000000000', '2019-07-26T08:00:00.000000000',
             '2019-07-26T09:00:00.000000000', '2019-07-26T10:00:00.000000000',
             '2019-07-26T11:00:00.000000000', '2019-07-26T12:00:00.000000000',
             '2019-07-26T13:00:00.000000000', '2019-07-26T14:00:00.000000000',
             '2019-07-26T15:00:00.000000000', '2019-07-26T16:00:00.000000000',
             '2019-07-26T17:00:00.000000000', '2019-07-26T18:00:00.000000000',
             '2019-07-26T19:00:00.000000000', '2019-07-26T20:00:00.000000000',
             '2019-07-26T21:00:00.000000000', '2019-07-26T22:00:00.000000000',
             '2019-07-26T23:00:00.000000000', '2019-07-27T00:00:00.000000000'],
            dtype='datetime64[ns]')
    • lon
      (location)
      float64
      ...
      [6 values with dtype=float64]
    • lat
      (location)
      float64
      ...
      [6 values with dtype=float64]
    • location
      (location)
      <U13
      'Provinciehuis' ... 'Sint-Bavo'
      array(['Provinciehuis', 'Melle', 'Honda', 'Wondelgem', 'Plantentuin',
             'Sint-Bavo'], dtype='<U13')
    • tas
      (location, time)
      float64
      ...
      standard_name :
      air_temperature
      long_name :
      Near-Surface Air Temperature
      units :
      °C
      cell_methods :
      time: point
      [720 values with dtype=float64]
    • time
      PandasIndex
      PandasIndex(DatetimeIndex(['2019-07-22 01:00:00', '2019-07-22 02:00:00',
                     '2019-07-22 03:00:00', '2019-07-22 04:00:00',
                     '2019-07-22 05:00:00', '2019-07-22 06:00:00',
                     '2019-07-22 07:00:00', '2019-07-22 08:00:00',
                     '2019-07-22 09:00:00', '2019-07-22 10:00:00',
                     ...
                     '2019-07-26 15:00:00', '2019-07-26 16:00:00',
                     '2019-07-26 17:00:00', '2019-07-26 18:00:00',
                     '2019-07-26 19:00:00', '2019-07-26 20:00:00',
                     '2019-07-26 21:00:00', '2019-07-26 22:00:00',
                     '2019-07-26 23:00:00', '2019-07-27 00:00:00'],
                    dtype='datetime64[ns]', name='time', length=120, freq=None))
    • location
      PandasIndex
      PandasIndex(Index(['Provinciehuis', 'Melle', 'Honda', 'Wondelgem', 'Plantentuin',
             'Sint-Bavo'],
            dtype='object', name='location'))
In [8]:
var_name_list = ["tas"]
run_name_list = ["initSFX"]
ds = open_data(data_dir, var_name_list, run_name_list)
ds
Out[8]:
<xarray.Dataset>
Dimensions:      (time: 720, lon: 75, lat: 70, run_name: 1, bnds: 2)
Coordinates:
  * time         (time) datetime64[ns] 2019-07-01T01:00:00 ... 2019-07-31
  * lon          (lon) float64 2.0 2.07 2.14 2.21 2.28 ... 6.97 7.04 7.11 7.18
  * lat          (lat) float64 49.0 49.05 49.09 49.13 ... 51.97 52.02 52.06 52.1
    time_bnds    (time, bnds) datetime64[ns] ...
    height       float64 ...
    crs          int64 ...
    rstart       <U10 ...
  * run_name     (run_name) <U7 'initSFX'
Dimensions without coordinates: bnds
Data variables:
    tas          (run_name, time, lat, lon) float32 16.69 17.13 ... 22.42 22.4
    frac_town    (run_name, lat, lon) float32 dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
    frac_water   (run_name, lat, lon) float32 dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
    frac_nature  (run_name, lat, lon) float32 dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
    frac_sea     (run_name, lat, lon) float32 dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
Attributes: (12/33)
    CDI:                       Climate Data Interface version 2.0.6 (https://...
    source:                    ALARO-1 (CY43T2) - SURFEX v8.0
    Conventions:               CF-1.11
    activity_id:               DD
    comment:                   
    contact:                   wout.dewettinck@ugent.be
    ...                        ...
    version_realization_info:  
    creation_date:             2024-11-12T10:18:38Z
    frequency:                 1hr
    StartTime:                 2019-07-01T00:00
    EndTime:                   2019-07-31T00:00
    CDO:                       Climate Data Operators version 2.0.6 (https://...
xarray.Dataset
    • time: 720
    • lon: 75
    • lat: 70
    • run_name: 1
    • bnds: 2
    • time
      (time)
      datetime64[ns]
      2019-07-01T01:00:00 ... 2019-07-31
      axis :
      T
      standard_name :
      time
      long_name :
      time
      bounds :
      time_bnds
      array(['2019-07-01T01:00:00.000000000', '2019-07-01T02:00:00.000000000',
             '2019-07-01T03:00:00.000000000', ..., '2019-07-30T22:00:00.000000000',
             '2019-07-30T23:00:00.000000000', '2019-07-31T00:00:00.000000000'],
            dtype='datetime64[ns]')
    • lon
      (lon)
      float64
      2.0 2.07 2.14 ... 7.04 7.11 7.18
      standard_name :
      longitude
      long_name :
      longitude
      units :
      degrees_east
      axis :
      X
      array([2.  , 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7 , 2.77,
             2.84, 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4 , 3.47, 3.54, 3.61,
             3.68, 3.75, 3.82, 3.89, 3.96, 4.03, 4.1 , 4.17, 4.24, 4.31, 4.38, 4.45,
             4.52, 4.59, 4.66, 4.73, 4.8 , 4.87, 4.94, 5.01, 5.08, 5.15, 5.22, 5.29,
             5.36, 5.43, 5.5 , 5.57, 5.64, 5.71, 5.78, 5.85, 5.92, 5.99, 6.06, 6.13,
             6.2 , 6.27, 6.34, 6.41, 6.48, 6.55, 6.62, 6.69, 6.76, 6.83, 6.9 , 6.97,
             7.04, 7.11, 7.18])
    • lat
      (lat)
      float64
      49.0 49.05 49.09 ... 52.06 52.1
      standard_name :
      latitude
      long_name :
      latitude
      units :
      degrees_north
      axis :
      Y
      array([49.   , 49.045, 49.09 , 49.135, 49.18 , 49.225, 49.27 , 49.315, 49.36 ,
             49.405, 49.45 , 49.495, 49.54 , 49.585, 49.63 , 49.675, 49.72 , 49.765,
             49.81 , 49.855, 49.9  , 49.945, 49.99 , 50.035, 50.08 , 50.125, 50.17 ,
             50.215, 50.26 , 50.305, 50.35 , 50.395, 50.44 , 50.485, 50.53 , 50.575,
             50.62 , 50.665, 50.71 , 50.755, 50.8  , 50.845, 50.89 , 50.935, 50.98 ,
             51.025, 51.07 , 51.115, 51.16 , 51.205, 51.25 , 51.295, 51.34 , 51.385,
             51.43 , 51.475, 51.52 , 51.565, 51.61 , 51.655, 51.7  , 51.745, 51.79 ,
             51.835, 51.88 , 51.925, 51.97 , 52.015, 52.06 , 52.105])
    • time_bnds
      (time, bnds)
      datetime64[ns]
      ...
      [1440 values with dtype=datetime64[ns]]
    • height
      ()
      float64
      ...
      long_name :
      height
      standard_name :
      height
      units :
      m
      positive :
      up
      axis :
      Z
      [1 values with dtype=float64]
    • crs
      ()
      int64
      ...
      grid_mapping_name :
      lambert_conformal_conic
      standard_parallel :
      [51.07 51.07]
      latitude_of_projection_origin :
      0.0
      longitude_of_central_meridian :
      3.6999999999999993
      earth_radius :
      6371229.0
      [1 values with dtype=int64]
    • rstart
      ()
      <U10
      ...
      [1 values with dtype=<U10]
    • run_name
      (run_name)
      <U7
      'initSFX'
      array(['initSFX'], dtype='<U7')
    • tas
      (run_name, time, lat, lon)
      float32
      16.69 17.13 17.26 ... 22.42 22.4
      standard_name :
      air_temperature
      long_name :
      Near-Surface Air Temperature
      units :
      °C
      cell_methods :
      time: point
      array([[[[16.689758 , 17.130737 , 17.258179 , ..., 23.617859 ,
                23.367676 , 23.06137  ],
               [16.265503 , 16.897247 , 17.088898 , ..., 23.565582 ,
                23.422089 , 22.996948 ],
               [16.014618 , 16.34909  , 16.50589  , ..., 23.578918 ,
                23.477478 , 22.938324 ],
               ...,
               [16.761353 , 16.759827 , 16.738861 , ..., 18.397034 ,
                18.274353 , 18.042725 ],
               [16.733032 , 16.713226 , 16.687042 , ..., 18.30542  ,
                18.21997  , 17.995758 ],
               [16.685211 , 16.688507 , 16.67929  , ..., 18.1333   ,
                18.119476 , 17.96817  ]],
      
              [[16.259186 , 16.639343 , 16.743011 , ..., 23.285156 ,
                23.087067 , 22.789215 ],
               [15.856934 , 16.411682 , 16.588379 , ..., 23.17511  ,
                23.098724 , 22.736603 ],
               [15.647827 , 15.921112 , 16.055298 , ..., 23.14624  ,
                23.12967  , 22.694824 ],
      ...
               [16.216095 , 16.11905  , 16.016815 , ..., 22.767761 ,
                22.76004  , 22.804413 ],
               [16.22992  , 16.114288 , 16.006195 , ..., 22.835266 ,
                22.770569 , 22.79718  ],
               [16.244781 , 16.13913  , 16.041107 , ..., 22.972412 ,
                22.88916  , 22.815887 ]],
      
              [[15.33606  , 15.695007 , 15.769745 , ..., 18.748108 ,
                18.754639 , 18.856812 ],
               [15.235565 , 15.6701355, 15.754608 , ..., 18.619995 ,
                18.09726  , 18.267365 ],
               [15.099701 , 15.290375 , 15.346985 , ..., 18.702698 ,
                17.97232  , 17.861328 ],
               ...,
               [16.31543  , 16.203125 , 16.089508 , ..., 22.223145 ,
                22.257202 , 22.303864 ],
               [16.326172 , 16.196716 , 16.081085 , ..., 22.256073 ,
                22.297394 , 22.34018  ],
               [16.338715 , 16.219025 , 16.1167   , ..., 22.320404 ,
                22.42212  , 22.40445  ]]]], dtype=float32)
    • frac_town
      (run_name, lat, lon)
      float32
      dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
      standard_name :
      town_fraction
      long_name :
      Town Fraction
      units :
      %
      Array Chunk
      Bytes 20.51 kiB 20.51 kiB
      Shape (1, 70, 75) (1, 70, 75)
      Dask graph 1 chunks in 3 graph layers
      Data type float32 numpy.ndarray
      75 70 1
    • frac_water
      (run_name, lat, lon)
      float32
      dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
      standard_name :
      water_fraction
      long_name :
      Water Fraction
      units :
      %
      Array Chunk
      Bytes 20.51 kiB 20.51 kiB
      Shape (1, 70, 75) (1, 70, 75)
      Dask graph 1 chunks in 3 graph layers
      Data type float32 numpy.ndarray
      75 70 1
    • frac_nature
      (run_name, lat, lon)
      float32
      dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
      standard_name :
      nature_fraction
      long_name :
      Nature Fraction
      units :
      %
      Array Chunk
      Bytes 20.51 kiB 20.51 kiB
      Shape (1, 70, 75) (1, 70, 75)
      Dask graph 1 chunks in 3 graph layers
      Data type float32 numpy.ndarray
      75 70 1
    • frac_sea
      (run_name, lat, lon)
      float32
      dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
      standard_name :
      sea_fraction
      long_name :
      Sea Fraction
      units :
      %
      Array Chunk
      Bytes 20.51 kiB 20.51 kiB
      Shape (1, 70, 75) (1, 70, 75)
      Dask graph 1 chunks in 3 graph layers
      Data type float32 numpy.ndarray
      75 70 1
    • time
      PandasIndex
      PandasIndex(DatetimeIndex(['2019-07-01 01:00:00', '2019-07-01 02:00:00',
                     '2019-07-01 03:00:00', '2019-07-01 04:00:00',
                     '2019-07-01 05:00:00', '2019-07-01 06:00:00',
                     '2019-07-01 07:00:00', '2019-07-01 08:00:00',
                     '2019-07-01 09:00:00', '2019-07-01 10:00:00',
                     ...
                     '2019-07-30 15:00:00', '2019-07-30 16:00:00',
                     '2019-07-30 17:00:00', '2019-07-30 18:00:00',
                     '2019-07-30 19:00:00', '2019-07-30 20:00:00',
                     '2019-07-30 21:00:00', '2019-07-30 22:00:00',
                     '2019-07-30 23:00:00', '2019-07-31 00:00:00'],
                    dtype='datetime64[ns]', name='time', length=720, freq=None))
    • lon
      PandasIndex
      PandasIndex(Index([               2.0,               2.07,               2.14,
                           2.21, 2.2800000000000002,               2.35,
                           2.42,               2.49,               2.56,
                           2.63,                2.7,               2.77,
                           2.84,               2.91,               2.98,
             3.0500000000000003,               3.12,               3.19,
             3.2600000000000002,               3.33, 3.4000000000000004,
                           3.47,               3.54, 3.6100000000000003,
                           3.68,               3.75, 3.8200000000000003,
                           3.89,               3.96,               4.03,
             4.1000000000000005,               4.17,               4.24,
             4.3100000000000005,               4.38,               4.45,
             4.5200000000000005,               4.59,               4.66,
                           4.73,  4.800000000000001,               4.87,
                           4.94,  5.010000000000001,               5.08,
                           5.15,  5.220000000000001,               5.29,
                           5.36,  5.430000000000001,                5.5,
                           5.57,  5.640000000000001,               5.71,
                           5.78, 5.8500000000000005,               5.92,
                           5.99, 6.0600000000000005,  6.130000000000001,
                            6.2, 6.2700000000000005,  6.340000000000001,
                           6.41,               6.48,  6.550000000000001,
                           6.62,               6.69,  6.760000000000001,
                           6.83,                6.9,  6.970000000000001,
              7.040000000000001,               7.11,  7.180000000000001],
            dtype='float64', name='lon'))
    • lat
      PandasIndex
      PandasIndex(Index([  49.0, 49.045,  49.09, 49.135,  49.18, 49.225,  49.27, 49.315,  49.36,
             49.405,  49.45, 49.495,  49.54, 49.585,  49.63, 49.675,  49.72, 49.765,
              49.81, 49.855,   49.9, 49.945,  49.99, 50.035,  50.08, 50.125,  50.17,
             50.215,  50.26, 50.305,  50.35, 50.395,  50.44, 50.485,  50.53, 50.575,
              50.62, 50.665,  50.71, 50.755,   50.8, 50.845,  50.89, 50.935,  50.98,
             51.025,  51.07, 51.115,  51.16, 51.205,  51.25, 51.295,  51.34, 51.385,
              51.43, 51.475,  51.52, 51.565,  51.61, 51.655,   51.7, 51.745,  51.79,
             51.835,  51.88, 51.925,  51.97, 52.015,  52.06, 52.105],
            dtype='float64', name='lat'))
    • run_name
      PandasIndex
      PandasIndex(Index(['initSFX'], dtype='object', name='run_name'))
  • CDI :
    Climate Data Interface version 2.0.6 (https://mpimet.mpg.de/cdi)
    source :
    ALARO-1 (CY43T2) - SURFEX v8.0
    Conventions :
    CF-1.11
    activity_id :
    DD
    comment :
    contact :
    wout.dewettinck@ugent.be
    domain :
    domain_id :
    driving_experiment :
    reanalysis simulation of the recent past
    driving_experiment_id :
    evaluation
    driving_institution_id :
    ECMWF
    driving_source_id :
    ERA5
    driving_variant_label :
    r1i1p1f1
    grid :
    Lambert conic conformal with 1.3 km grid spacing
    history :
    Tue Nov 12 11:30:52 2024: cdo -v remapcon,/dodrio/scratch/users/vsc45263/wout/CompPhys/simulations/src/grids/belgium_5km_latlon.txt initSFX_2019070100_720_tas_2019-07-01T01_2019-07-31T00_3600.nc initSFX_2019070100_720_tas_2019-07-01T01_2019-07-31T00_3600_regridded.nc
    institution :
    institution_id :
    license :
    https://cordex.org/data-access/cordex-cmip6-data/cordex-cmip6-terms-of-use
    mip_era :
    CMIP6
    product :
    model-output
    project_id :
    CORDEX
    references :
    source_id :
    source_type :
    ARCM
    tracking_id :
    variable_id :
    tas
    version_realization :
    v1-r1
    version_realization_info :
    creation_date :
    2024-11-12T10:18:38Z
    frequency :
    1hr
    StartTime :
    2019-07-01T00:00
    EndTime :
    2019-07-31T00:00
    CDO :
    Climate Data Operators version 2.0.6 (https://mpimet.mpg.de/cdo)
In [9]:
ds_locations_list = list()

for location in obs.location:
    lat = obs.lat.sel(location=location).values
    lon = obs.lon.sel(location=location).values
    ds_location = ds.sel(lat=lat, lon=lon, method="nearest").sel(run_name="initSFX")
    ds_locations_list.append(ds_location.assign_coords(location=location.values))

ds_locations = xr.concat(ds_locations_list, dim="location")
ds_locations
Out[9]:
<xarray.Dataset>
Dimensions:      (time: 720, location: 6, bnds: 2)
Coordinates:
  * time         (time) datetime64[ns] 2019-07-01T01:00:00 ... 2019-07-31
    lon          (location) float64 3.75 3.82 3.75 3.68 3.75 3.75
    lat          (location) float64 51.07 50.98 51.12 51.07 51.02 51.07
    time_bnds    (time, bnds) datetime64[ns] 2019-07-01 ... 2019-07-31
    height       float64 2.0
    crs          int64 0
    rstart       <U10 '2019070100'
    run_name     <U7 'initSFX'
  * location     (location) <U13 'Provinciehuis' 'Melle' ... 'Sint-Bavo'
Dimensions without coordinates: bnds
Data variables:
    tas          (location, time) float32 16.67 16.74 16.79 ... 17.89 17.6 17.24
    frac_town    (location) float32 dask.array<chunksize=(1,), meta=np.ndarray>
    frac_water   (location) float32 dask.array<chunksize=(1,), meta=np.ndarray>
    frac_nature  (location) float32 dask.array<chunksize=(1,), meta=np.ndarray>
    frac_sea     (location) float32 dask.array<chunksize=(1,), meta=np.ndarray>
Attributes: (12/33)
    CDI:                       Climate Data Interface version 2.0.6 (https://...
    source:                    ALARO-1 (CY43T2) - SURFEX v8.0
    Conventions:               CF-1.11
    activity_id:               DD
    comment:                   
    contact:                   wout.dewettinck@ugent.be
    ...                        ...
    version_realization_info:  
    creation_date:             2024-11-12T10:18:38Z
    frequency:                 1hr
    StartTime:                 2019-07-01T00:00
    EndTime:                   2019-07-31T00:00
    CDO:                       Climate Data Operators version 2.0.6 (https://...
xarray.Dataset
    • time: 720
    • location: 6
    • bnds: 2
    • time
      (time)
      datetime64[ns]
      2019-07-01T01:00:00 ... 2019-07-31
      axis :
      T
      standard_name :
      time
      long_name :
      time
      bounds :
      time_bnds
      array(['2019-07-01T01:00:00.000000000', '2019-07-01T02:00:00.000000000',
             '2019-07-01T03:00:00.000000000', ..., '2019-07-30T22:00:00.000000000',
             '2019-07-30T23:00:00.000000000', '2019-07-31T00:00:00.000000000'],
            dtype='datetime64[ns]')
    • lon
      (location)
      float64
      3.75 3.82 3.75 3.68 3.75 3.75
      standard_name :
      longitude
      long_name :
      longitude
      units :
      degrees_east
      axis :
      X
      array([3.75, 3.82, 3.75, 3.68, 3.75, 3.75])
    • lat
      (location)
      float64
      51.07 50.98 51.12 51.07 51.02 51.07
      standard_name :
      latitude
      long_name :
      latitude
      units :
      degrees_north
      axis :
      Y
      array([51.07 , 50.98 , 51.115, 51.07 , 51.025, 51.07 ])
    • time_bnds
      (time, bnds)
      datetime64[ns]
      2019-07-01 ... 2019-07-31
      array([['2019-07-01T00:00:00.000000000', '2019-07-01T01:00:00.000000000'],
             ['2019-07-01T01:00:00.000000000', '2019-07-01T02:00:00.000000000'],
             ['2019-07-01T02:00:00.000000000', '2019-07-01T03:00:00.000000000'],
             ...,
             ['2019-07-30T21:00:00.000000000', '2019-07-30T22:00:00.000000000'],
             ['2019-07-30T22:00:00.000000000', '2019-07-30T23:00:00.000000000'],
             ['2019-07-30T23:00:00.000000000', '2019-07-31T00:00:00.000000000']],
            dtype='datetime64[ns]')
    • height
      ()
      float64
      2.0
      long_name :
      height
      standard_name :
      height
      units :
      m
      positive :
      up
      axis :
      Z
      array(2.)
    • crs
      ()
      int64
      0
      grid_mapping_name :
      lambert_conformal_conic
      standard_parallel :
      [51.07 51.07]
      latitude_of_projection_origin :
      0.0
      longitude_of_central_meridian :
      3.6999999999999993
      earth_radius :
      6371229.0
      array(0, dtype=int64)
    • rstart
      ()
      <U10
      '2019070100'
      array('2019070100', dtype='<U10')
    • run_name
      ()
      <U7
      'initSFX'
      array('initSFX', dtype='<U7')
    • location
      (location)
      <U13
      'Provinciehuis' ... 'Sint-Bavo'
      array(['Provinciehuis', 'Melle', 'Honda', 'Wondelgem', 'Plantentuin',
             'Sint-Bavo'], dtype='<U13')
    • tas
      (location, time)
      float32
      16.67 16.74 16.79 ... 17.6 17.24
      standard_name :
      air_temperature
      long_name :
      Near-Surface Air Temperature
      units :
      °C
      cell_methods :
      time: point
      array([[16.665894, 16.737915, 16.788391, ..., 17.89441 , 17.60086 ,
              17.239563],
             [16.261566, 16.332794, 16.461273, ..., 17.370789, 17.1221  ,
              16.792267],
             [16.470215, 16.571228, 16.631622, ..., 17.720032, 17.521393,
              17.204163],
             [16.430634, 16.559357, 16.630554, ..., 17.528503, 17.289734,
              17.022919],
             [16.573608, 16.639252, 16.727783, ..., 17.734406, 17.4682  ,
              17.120087],
             [16.665894, 16.737915, 16.788391, ..., 17.89441 , 17.60086 ,
              17.239563]], dtype=float32)
    • frac_town
      (location)
      float32
      dask.array<chunksize=(1,), meta=np.ndarray>
      standard_name :
      town_fraction
      long_name :
      Town Fraction
      units :
      %
      Array Chunk
      Bytes 24 B 4 B
      Shape (6,) (1,)
      Dask graph 6 chunks in 19 graph layers
      Data type float32 numpy.ndarray
      6 1
    • frac_water
      (location)
      float32
      dask.array<chunksize=(1,), meta=np.ndarray>
      standard_name :
      water_fraction
      long_name :
      Water Fraction
      units :
      %
      Array Chunk
      Bytes 24 B 4 B
      Shape (6,) (1,)
      Dask graph 6 chunks in 19 graph layers
      Data type float32 numpy.ndarray
      6 1
    • frac_nature
      (location)
      float32
      dask.array<chunksize=(1,), meta=np.ndarray>
      standard_name :
      nature_fraction
      long_name :
      Nature Fraction
      units :
      %
      Array Chunk
      Bytes 24 B 4 B
      Shape (6,) (1,)
      Dask graph 6 chunks in 19 graph layers
      Data type float32 numpy.ndarray
      6 1
    • frac_sea
      (location)
      float32
      dask.array<chunksize=(1,), meta=np.ndarray>
      standard_name :
      sea_fraction
      long_name :
      Sea Fraction
      units :
      %
      Array Chunk
      Bytes 24 B 4 B
      Shape (6,) (1,)
      Dask graph 6 chunks in 19 graph layers
      Data type float32 numpy.ndarray
      6 1
    • time
      PandasIndex
      PandasIndex(DatetimeIndex(['2019-07-01 01:00:00', '2019-07-01 02:00:00',
                     '2019-07-01 03:00:00', '2019-07-01 04:00:00',
                     '2019-07-01 05:00:00', '2019-07-01 06:00:00',
                     '2019-07-01 07:00:00', '2019-07-01 08:00:00',
                     '2019-07-01 09:00:00', '2019-07-01 10:00:00',
                     ...
                     '2019-07-30 15:00:00', '2019-07-30 16:00:00',
                     '2019-07-30 17:00:00', '2019-07-30 18:00:00',
                     '2019-07-30 19:00:00', '2019-07-30 20:00:00',
                     '2019-07-30 21:00:00', '2019-07-30 22:00:00',
                     '2019-07-30 23:00:00', '2019-07-31 00:00:00'],
                    dtype='datetime64[ns]', name='time', length=720, freq=None))
    • location
      PandasIndex
      PandasIndex(Index(['Provinciehuis', 'Melle', 'Honda', 'Wondelgem', 'Plantentuin',
             'Sint-Bavo'],
            dtype='object', name='location'))
  • CDI :
    Climate Data Interface version 2.0.6 (https://mpimet.mpg.de/cdi)
    source :
    ALARO-1 (CY43T2) - SURFEX v8.0
    Conventions :
    CF-1.11
    activity_id :
    DD
    comment :
    contact :
    wout.dewettinck@ugent.be
    domain :
    domain_id :
    driving_experiment :
    reanalysis simulation of the recent past
    driving_experiment_id :
    evaluation
    driving_institution_id :
    ECMWF
    driving_source_id :
    ERA5
    driving_variant_label :
    r1i1p1f1
    grid :
    Lambert conic conformal with 1.3 km grid spacing
    history :
    Tue Nov 12 11:30:52 2024: cdo -v remapcon,/dodrio/scratch/users/vsc45263/wout/CompPhys/simulations/src/grids/belgium_5km_latlon.txt initSFX_2019070100_720_tas_2019-07-01T01_2019-07-31T00_3600.nc initSFX_2019070100_720_tas_2019-07-01T01_2019-07-31T00_3600_regridded.nc
    institution :
    institution_id :
    license :
    https://cordex.org/data-access/cordex-cmip6-data/cordex-cmip6-terms-of-use
    mip_era :
    CMIP6
    product :
    model-output
    project_id :
    CORDEX
    references :
    source_id :
    source_type :
    ARCM
    tracking_id :
    variable_id :
    tas
    version_realization :
    v1-r1
    version_realization_info :
    creation_date :
    2024-11-12T10:18:38Z
    frequency :
    1hr
    StartTime :
    2019-07-01T00:00
    EndTime :
    2019-07-31T00:00
    CDO :
    Climate Data Operators version 2.0.6 (https://mpimet.mpg.de/cdo)
In [10]:
ds_locations.frac_town.load()
Out[10]:
<xarray.DataArray 'frac_town' (location: 6)>
array([0.48960358, 0.0720843 , 0.20285054, 0.41070563, 0.41838965,
       0.48960358], dtype=float32)
Coordinates:
    lon       (location) float64 3.75 3.82 3.75 3.68 3.75 3.75
    lat       (location) float64 51.07 50.98 51.12 51.07 51.02 51.07
    height    float64 2.0
    crs       int64 0
    rstart    <U10 '2019070100'
    run_name  <U7 'initSFX'
  * location  (location) <U13 'Provinciehuis' 'Melle' ... 'Sint-Bavo'
Attributes:
    standard_name:  town_fraction
    long_name:      Town Fraction
    units:          %
xarray.DataArray
'frac_town'
  • location: 6
  • 0.4896 0.07208 0.2029 0.4107 0.4184 0.4896
    array([0.48960358, 0.0720843 , 0.20285054, 0.41070563, 0.41838965,
           0.48960358], dtype=float32)
    • lon
      (location)
      float64
      3.75 3.82 3.75 3.68 3.75 3.75
      standard_name :
      longitude
      long_name :
      longitude
      units :
      degrees_east
      axis :
      X
      array([3.75, 3.82, 3.75, 3.68, 3.75, 3.75])
    • lat
      (location)
      float64
      51.07 50.98 51.12 51.07 51.02 51.07
      standard_name :
      latitude
      long_name :
      latitude
      units :
      degrees_north
      axis :
      Y
      array([51.07 , 50.98 , 51.115, 51.07 , 51.025, 51.07 ])
    • height
      ()
      float64
      2.0
      long_name :
      height
      standard_name :
      height
      units :
      m
      positive :
      up
      axis :
      Z
      array(2.)
    • crs
      ()
      int64
      0
      grid_mapping_name :
      lambert_conformal_conic
      standard_parallel :
      [51.07 51.07]
      latitude_of_projection_origin :
      0.0
      longitude_of_central_meridian :
      3.6999999999999993
      earth_radius :
      6371229.0
      array(0, dtype=int64)
    • rstart
      ()
      <U10
      '2019070100'
      array('2019070100', dtype='<U10')
    • run_name
      ()
      <U7
      'initSFX'
      array('initSFX', dtype='<U7')
    • location
      (location)
      <U13
      'Provinciehuis' ... 'Sint-Bavo'
      array(['Provinciehuis', 'Melle', 'Honda', 'Wondelgem', 'Plantentuin',
             'Sint-Bavo'], dtype='<U13')
    • location
      PandasIndex
      PandasIndex(Index(['Provinciehuis', 'Melle', 'Honda', 'Wondelgem', 'Plantentuin',
             'Sint-Bavo'],
            dtype='object', name='location'))
  • standard_name :
    town_fraction
    long_name :
    Town Fraction
    units :
    %

Provinciehuis (and Sint-Bavo) have the highest town fraction (49 %); Melle has the lowest (7 %).

In [11]:
fig, ax = plt.subplots()

ds_uhi = ds_locations.sel(location="Provinciehuis") - ds_locations.sel(location="Melle")
ds_uhi_period = ds_uhi.sel(time=slice(tstart, tstop))
tas_uhi_dc = ds_uhi_period.groupby("time.hour").mean().tas
tas_uhi_dc.plot(ax=ax, label="UHI simulation")

obs_uhi = obs.sel(location="Provinciehuis") - obs.sel(location="Melle")
obs_tas_uhi_dc = obs_uhi.groupby("time.hour").mean().tas
obs_tas_uhi_dc.plot(ax=ax, label="UHI observations")

ax.set_title(f"UHI Intensity for period\nbetween {tstart} and {tstop}")
ax.set_ylabel("Temperature [°C]")
ax.legend()

plt.show()
No description has been provided for this image

An nightly UHI is present in the simulations but it is quite small, with a magnitude of only 0.5°C. On the other hand, the observations exhibit a very clear and strong UHI with a magnitude of up to 4°C.

In [12]:
bias = (ds_locations - obs).sel(location=["Melle", "Provinciehuis"])
bias_tas_dc = bias.groupby("time.hour").mean().tas

fig, ax = plt.subplots()
bias_tas_dc.plot(ax=ax, hue="location")
ax.set_title(f"Bias in near-surface air temperature for period\nbetween {tstart} and {tstop}")
ax.set_ylabel("Temperature [°C]")

plt.show()
No description has been provided for this image

Plotting the bias in both locations shows that the simulations are too warm compared to the observations. However, at nighttime in Melle, the warm bias is more than 3 degrees higher in Melle, which explains why the UHI is much less present in the simulations.

If we take $T^S_U$ and $T^S_R$ as the simulated temperatures for respectively an urban and rural location, and $T^O_U$ and $T^O_R$ for the observational values, we can connect the UHI values with the biases as follows: $$UHI^S = T^S_U - T^S_R \text{ and } UHI^O = T^O_U - T^O_R$$ $$BIAS_R = T^S_R - T^O_R \text{ and } BIAS_U = T^S_U - T^O_U$$ $$\Longrightarrow BIAS_U - BIAS_R = UHI^S - UHI^O$$

3. Energy exchange with the surface¶

An important factor which influences the state of the atmosphere, and hence the weather, is its interaction with the surface. This interaction can be represented as the exchange of energy in the form of fluxes. We consider three types of energy exchange: radiation, sensible heat flux and latent heat flux. The variable names corresponding to these fluxes are respectively rnetds, hfss and hfls.

  • Load in the simulation data of these fluxes for the initSFX-simulation from 1 July 2019 (720 hours).
  • What are the units of these fluxes?
  • Select again the data from Uccle and from the period between 22 and 26 July 2019. Plot the ernergy fluxes in function of time.
  • We will now determine the sign of these fluxes:
    • The radiation flux rnetds is the net radiation flux: it is the difference between the outgoing and incoming radiation. The incoming radiation is primarily shortwave radiation: either direct (from the Sun) or diffuse (scattered solar radiation). The outgoing radiation is emmited by the surface itself; it is longwave radiation. The difference between these two contributions is the net radiation flux. When is this variable positive and negative? What does this mean: is a positive flux directed into or out of the surface?
    • The sensible heat flux hfss is the heat transfer caused by the temperature difference between the surface and the atmosphere. The heat is transfered from the medium with the highest temperature to the medium with the lowest temperature. Compare the near-surface air temperature (tas) with the surface temperature (ts). Use this difference between ts and ts to derive the sign of the sensible heat flux.
    • The latent heat flux is caused by the evaporation of soil moisture. This evaporation requires latent heat for the phase transition between the liquid and vapor phase. This heat is extracted from the soil, which causes it to cool. Consider the latent heat flux. In what direction is the postive latent heat flux defined?
  • Calculate the net energy flux into the surface by adding or subtracting (depending on how the direction is defined) the three flux contributions. Compare this with the surface temperature, stored in the variable ts.

Solutions:¶

In [13]:
var_name_list = ["rnetds", "hfss", "hfls", "tas", "ts"]
run_name_list = ["initSFX"]
ds = open_data(data_dir, var_name_list, run_name_list)
ds
Out[13]:
<xarray.Dataset>
Dimensions:      (time: 720, lon: 75, lat: 70, run_name: 1, bnds: 2)
Coordinates:
  * time         (time) datetime64[ns] 2019-07-01T01:00:00 ... 2019-07-31
  * lon          (lon) float64 2.0 2.07 2.14 2.21 2.28 ... 6.97 7.04 7.11 7.18
  * lat          (lat) float64 49.0 49.05 49.09 49.13 ... 51.97 52.02 52.06 52.1
    time_bnds    (time, bnds) datetime64[ns] 2019-07-01 ... 2019-07-31
    crs          int64 0
    rstart       <U10 '2019070100'
  * run_name     (run_name) <U7 'initSFX'
Dimensions without coordinates: bnds
Data variables:
    rnetds       (run_name, time, lat, lon) float32 -54.07 -55.14 ... -67.98
    hfss         (run_name, time, lat, lon) float32 2.34 7.096 ... -28.26 -28.61
    hfls         (run_name, time, lat, lon) float32 1.587 1.883 ... 0.6988
    tas          (run_name, time, lat, lon) float32 16.69 17.13 ... 22.42 22.4
    ts           (run_name, time, lat, lon) float32 16.91 17.49 ... 21.82 21.75
    frac_town    (run_name, lat, lon) float32 dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
    frac_water   (run_name, lat, lon) float32 dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
    frac_nature  (run_name, lat, lon) float32 dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
    frac_sea     (run_name, lat, lon) float32 dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
Attributes: (12/33)
    CDI:                       Climate Data Interface version 2.0.6 (https://...
    source:                    ALARO-1 (CY43T2) - SURFEX v8.0
    Conventions:               CF-1.11
    activity_id:               DD
    comment:                   
    contact:                   wout.dewettinck@ugent.be
    ...                        ...
    version_realization_info:  
    creation_date:             2024-11-12T10:19:39Z
    frequency:                 1hr
    StartTime:                 2019-07-01T00:00
    EndTime:                   2019-07-31T00:00
    CDO:                       Climate Data Operators version 2.0.6 (https://...
xarray.Dataset
    • time: 720
    • lon: 75
    • lat: 70
    • run_name: 1
    • bnds: 2
    • time
      (time)
      datetime64[ns]
      2019-07-01T01:00:00 ... 2019-07-31
      axis :
      T
      standard_name :
      time
      long_name :
      time
      bounds :
      time_bnds
      array(['2019-07-01T01:00:00.000000000', '2019-07-01T02:00:00.000000000',
             '2019-07-01T03:00:00.000000000', ..., '2019-07-30T22:00:00.000000000',
             '2019-07-30T23:00:00.000000000', '2019-07-31T00:00:00.000000000'],
            dtype='datetime64[ns]')
    • lon
      (lon)
      float64
      2.0 2.07 2.14 ... 7.04 7.11 7.18
      standard_name :
      longitude
      long_name :
      longitude
      units :
      degrees_east
      axis :
      X
      array([2.  , 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7 , 2.77,
             2.84, 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4 , 3.47, 3.54, 3.61,
             3.68, 3.75, 3.82, 3.89, 3.96, 4.03, 4.1 , 4.17, 4.24, 4.31, 4.38, 4.45,
             4.52, 4.59, 4.66, 4.73, 4.8 , 4.87, 4.94, 5.01, 5.08, 5.15, 5.22, 5.29,
             5.36, 5.43, 5.5 , 5.57, 5.64, 5.71, 5.78, 5.85, 5.92, 5.99, 6.06, 6.13,
             6.2 , 6.27, 6.34, 6.41, 6.48, 6.55, 6.62, 6.69, 6.76, 6.83, 6.9 , 6.97,
             7.04, 7.11, 7.18])
    • lat
      (lat)
      float64
      49.0 49.05 49.09 ... 52.06 52.1
      standard_name :
      latitude
      long_name :
      latitude
      units :
      degrees_north
      axis :
      Y
      array([49.   , 49.045, 49.09 , 49.135, 49.18 , 49.225, 49.27 , 49.315, 49.36 ,
             49.405, 49.45 , 49.495, 49.54 , 49.585, 49.63 , 49.675, 49.72 , 49.765,
             49.81 , 49.855, 49.9  , 49.945, 49.99 , 50.035, 50.08 , 50.125, 50.17 ,
             50.215, 50.26 , 50.305, 50.35 , 50.395, 50.44 , 50.485, 50.53 , 50.575,
             50.62 , 50.665, 50.71 , 50.755, 50.8  , 50.845, 50.89 , 50.935, 50.98 ,
             51.025, 51.07 , 51.115, 51.16 , 51.205, 51.25 , 51.295, 51.34 , 51.385,
             51.43 , 51.475, 51.52 , 51.565, 51.61 , 51.655, 51.7  , 51.745, 51.79 ,
             51.835, 51.88 , 51.925, 51.97 , 52.015, 52.06 , 52.105])
    • time_bnds
      (time, bnds)
      datetime64[ns]
      2019-07-01 ... 2019-07-31
      array([['2019-07-01T00:00:00.000000000', '2019-07-01T01:00:00.000000000'],
             ['2019-07-01T01:00:00.000000000', '2019-07-01T02:00:00.000000000'],
             ['2019-07-01T02:00:00.000000000', '2019-07-01T03:00:00.000000000'],
             ...,
             ['2019-07-30T21:00:00.000000000', '2019-07-30T22:00:00.000000000'],
             ['2019-07-30T22:00:00.000000000', '2019-07-30T23:00:00.000000000'],
             ['2019-07-30T23:00:00.000000000', '2019-07-31T00:00:00.000000000']],
            dtype='datetime64[ns]')
    • crs
      ()
      int64
      0
      grid_mapping_name :
      lambert_conformal_conic
      standard_parallel :
      [51.07 51.07]
      latitude_of_projection_origin :
      0.0
      longitude_of_central_meridian :
      3.6999999999999993
      earth_radius :
      6371229.0
      array(0, dtype=int64)
    • rstart
      ()
      <U10
      '2019070100'
      array('2019070100', dtype='<U10')
    • run_name
      (run_name)
      <U7
      'initSFX'
      array(['initSFX'], dtype='<U7')
    • rnetds
      (run_name, time, lat, lon)
      float32
      -54.07 -55.14 ... -70.94 -67.98
      standard_name :
      surface_net_downwelling_flux_in_air
      long_name :
      Surface Net Downwelling Radiation
      units :
      W m-2
      cell_methods :
      time: point
      array([[[[-54.072746, -55.13729 , -55.191193, ..., -50.730347,
                -49.35609 , -47.275326],
               [-53.255657, -55.393105, -55.12176 , ..., -50.60678 ,
                -50.169666, -47.729343],
               [-52.387802, -53.527695, -53.66145 , ..., -50.835552,
                -49.433617, -46.756798],
               ...,
               [-78.01525 , -76.96731 , -76.25376 , ..., -79.9459  ,
                -78.624756, -77.12793 ],
               [-78.026634, -77.023964, -76.31222 , ..., -79.668175,
                -78.60985 , -77.28928 ],
               [-78.048775, -76.99492 , -76.24093 , ..., -78.46734 ,
                -78.1033  , -77.31603 ]],
      
              [[-52.7138  , -53.80618 , -54.281937, ..., -49.66155 ,
                -47.569935, -43.675552],
               [-51.806675, -53.564846, -53.753944, ..., -50.259674,
                -49.80317 , -46.99324 ],
               [-51.387897, -52.199787, -52.50662 , ..., -50.99074 ,
                -50.342396, -48.285233],
      ...
               [-43.945404, -47.441322, -50.511143, ..., -64.8485  ,
                -63.49167 , -63.974293],
               [-43.656532, -43.925266, -49.35758 , ..., -64.44926 ,
                -60.035362, -60.57732 ],
               [-44.1106  , -42.162247, -46.97086 , ..., -63.68734 ,
                -59.751858, -58.465004]],
      
              [[-38.55018 , -38.338615, -37.762413, ..., -57.14035 ,
                -60.950058, -61.148296],
               [-37.78855 , -37.973946, -36.640015, ..., -56.64265 ,
                -56.192776, -59.495995],
               [-37.032112, -37.25    , -36.293865, ..., -58.328087,
                -54.41279 , -56.674667],
               ...,
               [-42.425602, -46.57183 , -46.571785, ..., -74.65824 ,
                -72.18467 , -68.44672 ],
               [-42.86252 , -46.240906, -48.325542, ..., -74.475876,
                -71.48833 , -68.18192 ],
               [-42.087036, -44.211895, -49.359253, ..., -74.201866,
                -70.93827 , -67.98191 ]]]], dtype=float32)
    • hfss
      (run_name, time, lat, lon)
      float32
      2.34 7.096 7.314 ... -28.26 -28.61
      standard_name :
      surface_upward_sensible_heat_flux
      long_name :
      Surface Upward Sensible Heat Flux
      units :
      W m-2
      cell_methods :
      time: point
      array([[[[  2.3403022 ,   7.0962963 ,   7.313968  , ...,  -6.8306613 ,
                 -6.1559343 ,  -5.01661   ],
               [  2.6778054 ,  10.403624  ,   9.072765  , ...,  -6.4312077 ,
                 -5.2566156 ,  -4.701543  ],
               [ -3.7093496 ,   1.0443038 ,   1.9852906 , ...,  -5.5924115 ,
                 -3.99854   ,  -4.6591573 ],
               ...,
               [-14.957617  , -16.499088  , -17.487713  , ..., -12.121108  ,
                -12.596507  , -12.704117  ],
               [-14.343806  , -15.91372   , -16.95495   , ..., -12.899076  ,
                -12.795825  , -12.673551  ],
               [-13.520174  , -15.318224  , -16.46207   , ..., -13.262414  ,
                -13.344319  , -12.945044  ]],
      
              [[  0.59481263,   4.1873727 ,   4.073781  , ...,  -9.874452  ,
                -11.707441  , -11.7317095 ],
               [  1.0062684 ,   7.426009  ,   6.3732595 , ...,  -9.062812  ,
                -10.115893  , -12.258611  ],
               [ -4.033235  ,  -0.06542522,   0.5157754 , ...,  -8.257209  ,
                 -8.807902  , -12.719376  ],
      ...
               [-15.878032  , -17.597582  , -18.210802  , ..., -33.935703  ,
                -30.222952  , -25.754816  ],
               [-15.784719  , -17.60823   , -18.229193  , ..., -32.743336  ,
                -30.374361  , -25.302431  ],
               [-16.24737   , -17.583225  , -18.348291  , ..., -31.11923   ,
                -30.627306  , -26.672194  ]],
      
              [[-28.016924  , -16.267612  , -11.775693  , ..., -38.469757  ,
                -28.23804   , -19.412802  ],
               [-17.128618  , -11.411778  ,  -9.163486  , ..., -33.49456   ,
                -28.802343  , -18.346699  ],
               [-17.961618  , -14.5934    , -13.053025  , ..., -27.74886   ,
                -22.096209  , -17.718386  ],
               ...,
               [-17.481972  , -18.48129   , -18.869785  , ..., -25.458572  ,
                -26.86811   , -25.202583  ],
               [-17.71172   , -18.540537  , -18.955381  , ..., -25.319359  ,
                -26.40801   , -25.53769   ],
               [-17.868673  , -18.698908  , -19.177212  , ..., -24.825699  ,
                -28.25639   , -28.61415   ]]]], dtype=float32)
    • hfls
      (run_name, time, lat, lon)
      float32
      1.587 1.883 2.182 ... 0.6217 0.6988
      standard_name :
      surface_upward_latent_heat_flux
      long_name :
      Surface Upward Latent Heat Flux
      units :
      W m-2
      cell_methods :
      time: point
      array([[[[ 1.5871494 ,  1.882981  ,  2.182155  , ...,  0.61377186,
                 0.75611776,  0.7374565 ],
               [ 1.5059625 ,  2.624376  ,  2.1517785 , ...,  0.6789539 ,
                 0.5233627 ,  0.50455374],
               [ 0.45577332,  1.1534106 ,  0.931895  , ...,  0.7528053 ,
                 0.5763913 ,  0.45185477],
               ...,
               [52.19797   , 48.877728  , 46.45443   , ...,  0.21506834,
                 0.2564164 ,  0.23324901],
               [52.119213  , 48.727955  , 46.36856   , ...,  0.30239487,
                 0.24531889,  0.23199445],
               [52.53805   , 49.08932   , 46.573     , ...,  0.5940207 ,
                 0.2411244 ,  0.24840768]],
      
              [[ 1.4348931 ,  1.629317  ,  1.939239  , ...,  0.82047224,
                 0.9130325 ,  0.9413589 ],
               [ 1.5727301 ,  2.445949  ,  1.9913328 , ...,  0.96018785,
                 0.660363  ,  0.721078  ],
               [ 0.5074889 ,  1.2310405 ,  0.9929932 , ...,  1.1759499 ,
                 0.8234406 ,  0.6515399 ],
      ...
               [65.18932   , 60.602615  , 57.06664   , ...,  1.0171853 ,
                 1.271093  ,  1.3400215 ],
               [64.21372   , 59.87609   , 56.058453  , ...,  1.3134444 ,
                 1.5049523 ,  1.479442  ],
               [65.032814  , 59.508865  , 56.027542  , ...,  1.6653796 ,
                 1.51856   ,  1.5713348 ]],
      
              [[39.398975  , 31.346966  , 28.00406   , ..., 18.407736  ,
                 7.3634806 ,  0.7367801 ],
               [27.76311   , 29.172684  , 25.36974   , ..., 14.993234  ,
                18.92886   ,  3.2834294 ],
               [20.477219  , 22.006979  , 20.86296   , ...,  8.419171  ,
                18.564255  ,  8.615678  ],
               ...,
               [65.44966   , 60.19456   , 55.842064  , ...,  0.5231329 ,
                 0.59498394,  0.4910763 ],
               [65.383835  , 59.757492  , 55.353577  , ...,  0.52000225,
                 0.6418467 ,  0.5143097 ],
               [64.64785   , 59.858444  , 55.552315  , ...,  0.5991925 ,
                 0.62171453,  0.69878787]]]], dtype=float32)
    • tas
      (run_name, time, lat, lon)
      float32
      16.69 17.13 17.26 ... 22.42 22.4
      standard_name :
      air_temperature
      long_name :
      Near-Surface Air Temperature
      units :
      °C
      cell_methods :
      time: point
      array([[[[16.689758 , 17.130737 , 17.258179 , ..., 23.617859 ,
                23.367676 , 23.06137  ],
               [16.265503 , 16.897247 , 17.088898 , ..., 23.565582 ,
                23.422089 , 22.996948 ],
               [16.014618 , 16.34909  , 16.50589  , ..., 23.578918 ,
                23.477478 , 22.938324 ],
               ...,
               [16.761353 , 16.759827 , 16.738861 , ..., 18.397034 ,
                18.274353 , 18.042725 ],
               [16.733032 , 16.713226 , 16.687042 , ..., 18.30542  ,
                18.21997  , 17.995758 ],
               [16.685211 , 16.688507 , 16.67929  , ..., 18.1333   ,
                18.119476 , 17.96817  ]],
      
              [[16.259186 , 16.639343 , 16.743011 , ..., 23.285156 ,
                23.087067 , 22.789215 ],
               [15.856934 , 16.411682 , 16.588379 , ..., 23.17511  ,
                23.098724 , 22.736603 ],
               [15.647827 , 15.921112 , 16.055298 , ..., 23.14624  ,
                23.12967  , 22.694824 ],
      ...
               [16.216095 , 16.11905  , 16.016815 , ..., 22.767761 ,
                22.76004  , 22.804413 ],
               [16.22992  , 16.114288 , 16.006195 , ..., 22.835266 ,
                22.770569 , 22.79718  ],
               [16.244781 , 16.13913  , 16.041107 , ..., 22.972412 ,
                22.88916  , 22.815887 ]],
      
              [[15.33606  , 15.695007 , 15.769745 , ..., 18.748108 ,
                18.754639 , 18.856812 ],
               [15.235565 , 15.6701355, 15.754608 , ..., 18.619995 ,
                18.09726  , 18.267365 ],
               [15.099701 , 15.290375 , 15.346985 , ..., 18.702698 ,
                17.97232  , 17.861328 ],
               ...,
               [16.31543  , 16.203125 , 16.089508 , ..., 22.223145 ,
                22.257202 , 22.303864 ],
               [16.326172 , 16.196716 , 16.081085 , ..., 22.256073 ,
                22.297394 , 22.34018  ],
               [16.338715 , 16.219025 , 16.1167   , ..., 22.320404 ,
                22.42212  , 22.40445  ]]]], dtype=float32)
    • ts
      (run_name, time, lat, lon)
      float32
      16.91 17.49 17.62 ... 21.82 21.75
      standard_name :
      surface_temperature
      long_name :
      Surface Temperature
      units :
      °C
      cell_methods :
      time: point
      array([[[[16.911804 , 17.490295 , 17.6167   , ..., 23.38086  ,
                23.039886 , 22.596832 ],
               [16.484772 , 17.351013 , 17.423553 , ..., 23.332886 ,
                23.178009 , 22.602478 ],
               [16.01712  , 16.513977 , 16.676392 , ..., 23.3656   ,
                23.17331  , 22.504333 ],
               ...,
               [15.742462 , 15.61145  , 15.508331 , ..., 18.007874 ,
                17.771729 , 17.444763 ],
               [15.74884  , 15.600037 , 15.490448 , ..., 17.89148  ,
                17.70816  , 17.405853 ],
               [15.754272 , 15.6128845, 15.50943  , ..., 17.623291 ,
                17.591797 , 17.39389  ]],
      
              [[16.41623  , 16.89148  , 16.989319 , ..., 23.119293 ,
                22.835968 , 22.412323 ],
               [16.00409  , 16.735931 , 16.819946 , ..., 23.031433 ,
                22.92688  , 22.446655 ],
               [15.6493225, 16.038666 , 16.175629 , ..., 23.033081 ,
                22.93454  , 22.399231 ],
      ...
               [15.742493 , 15.611694 , 15.508423 , ..., 22.05539  ,
                21.984314 , 22.010223 ],
               [15.74881  , 15.60025  , 15.4904785, ..., 22.137726 ,
                21.99353  , 22.030396 ],
               [15.754242 , 15.6128845, 15.509186 , ..., 22.230316 ,
                22.133698 , 22.05249  ]],
      
              [[14.861237 , 15.306152 , 15.5383   , ..., 17.834045 ,
                18.138458 , 18.251556 ],
               [14.8107605, 15.339539 , 15.444305 , ..., 17.800629 ,
                17.298431 , 17.655365 ],
               [14.650726 , 14.916534 , 15.009064 , ..., 17.969147 ,
                17.094177 , 17.130066 ],
               ...,
               [15.742798 , 15.611542 , 15.50824  , ..., 21.724548 ,
                21.672699 , 21.663666 ],
               [15.749207 , 15.5998535, 15.490448 , ..., 21.751251 ,
                21.697205 , 21.702942 ],
               [15.754089 , 15.612671 , 15.509308 , ..., 21.761902 ,
                21.818665 , 21.746521 ]]]], dtype=float32)
    • frac_town
      (run_name, lat, lon)
      float32
      dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
      standard_name :
      town_fraction
      long_name :
      Town Fraction
      units :
      %
      Array Chunk
      Bytes 20.51 kiB 20.51 kiB
      Shape (1, 70, 75) (1, 70, 75)
      Dask graph 1 chunks in 3 graph layers
      Data type float32 numpy.ndarray
      75 70 1
    • frac_water
      (run_name, lat, lon)
      float32
      dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
      standard_name :
      water_fraction
      long_name :
      Water Fraction
      units :
      %
      Array Chunk
      Bytes 20.51 kiB 20.51 kiB
      Shape (1, 70, 75) (1, 70, 75)
      Dask graph 1 chunks in 3 graph layers
      Data type float32 numpy.ndarray
      75 70 1
    • frac_nature
      (run_name, lat, lon)
      float32
      dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
      standard_name :
      nature_fraction
      long_name :
      Nature Fraction
      units :
      %
      Array Chunk
      Bytes 20.51 kiB 20.51 kiB
      Shape (1, 70, 75) (1, 70, 75)
      Dask graph 1 chunks in 3 graph layers
      Data type float32 numpy.ndarray
      75 70 1
    • frac_sea
      (run_name, lat, lon)
      float32
      dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
      standard_name :
      sea_fraction
      long_name :
      Sea Fraction
      units :
      %
      Array Chunk
      Bytes 20.51 kiB 20.51 kiB
      Shape (1, 70, 75) (1, 70, 75)
      Dask graph 1 chunks in 3 graph layers
      Data type float32 numpy.ndarray
      75 70 1
    • time
      PandasIndex
      PandasIndex(DatetimeIndex(['2019-07-01 01:00:00', '2019-07-01 02:00:00',
                     '2019-07-01 03:00:00', '2019-07-01 04:00:00',
                     '2019-07-01 05:00:00', '2019-07-01 06:00:00',
                     '2019-07-01 07:00:00', '2019-07-01 08:00:00',
                     '2019-07-01 09:00:00', '2019-07-01 10:00:00',
                     ...
                     '2019-07-30 15:00:00', '2019-07-30 16:00:00',
                     '2019-07-30 17:00:00', '2019-07-30 18:00:00',
                     '2019-07-30 19:00:00', '2019-07-30 20:00:00',
                     '2019-07-30 21:00:00', '2019-07-30 22:00:00',
                     '2019-07-30 23:00:00', '2019-07-31 00:00:00'],
                    dtype='datetime64[ns]', name='time', length=720, freq=None))
    • lon
      PandasIndex
      PandasIndex(Index([               2.0,               2.07,               2.14,
                           2.21, 2.2800000000000002,               2.35,
                           2.42,               2.49,               2.56,
                           2.63,                2.7,               2.77,
                           2.84,               2.91,               2.98,
             3.0500000000000003,               3.12,               3.19,
             3.2600000000000002,               3.33, 3.4000000000000004,
                           3.47,               3.54, 3.6100000000000003,
                           3.68,               3.75, 3.8200000000000003,
                           3.89,               3.96,               4.03,
             4.1000000000000005,               4.17,               4.24,
             4.3100000000000005,               4.38,               4.45,
             4.5200000000000005,               4.59,               4.66,
                           4.73,  4.800000000000001,               4.87,
                           4.94,  5.010000000000001,               5.08,
                           5.15,  5.220000000000001,               5.29,
                           5.36,  5.430000000000001,                5.5,
                           5.57,  5.640000000000001,               5.71,
                           5.78, 5.8500000000000005,               5.92,
                           5.99, 6.0600000000000005,  6.130000000000001,
                            6.2, 6.2700000000000005,  6.340000000000001,
                           6.41,               6.48,  6.550000000000001,
                           6.62,               6.69,  6.760000000000001,
                           6.83,                6.9,  6.970000000000001,
              7.040000000000001,               7.11,  7.180000000000001],
            dtype='float64', name='lon'))
    • lat
      PandasIndex
      PandasIndex(Index([  49.0, 49.045,  49.09, 49.135,  49.18, 49.225,  49.27, 49.315,  49.36,
             49.405,  49.45, 49.495,  49.54, 49.585,  49.63, 49.675,  49.72, 49.765,
              49.81, 49.855,   49.9, 49.945,  49.99, 50.035,  50.08, 50.125,  50.17,
             50.215,  50.26, 50.305,  50.35, 50.395,  50.44, 50.485,  50.53, 50.575,
              50.62, 50.665,  50.71, 50.755,   50.8, 50.845,  50.89, 50.935,  50.98,
             51.025,  51.07, 51.115,  51.16, 51.205,  51.25, 51.295,  51.34, 51.385,
              51.43, 51.475,  51.52, 51.565,  51.61, 51.655,   51.7, 51.745,  51.79,
             51.835,  51.88, 51.925,  51.97, 52.015,  52.06, 52.105],
            dtype='float64', name='lat'))
    • run_name
      PandasIndex
      PandasIndex(Index(['initSFX'], dtype='object', name='run_name'))
  • CDI :
    Climate Data Interface version 2.0.6 (https://mpimet.mpg.de/cdi)
    source :
    ALARO-1 (CY43T2) - SURFEX v8.0
    Conventions :
    CF-1.11
    activity_id :
    DD
    comment :
    contact :
    wout.dewettinck@ugent.be
    domain :
    domain_id :
    driving_experiment :
    reanalysis simulation of the recent past
    driving_experiment_id :
    evaluation
    driving_institution_id :
    ECMWF
    driving_source_id :
    ERA5
    driving_variant_label :
    r1i1p1f1
    grid :
    Lambert conic conformal with 1.3 km grid spacing
    history :
    Tue Nov 12 11:30:50 2024: cdo -v remapcon,/dodrio/scratch/users/vsc45263/wout/CompPhys/simulations/src/grids/belgium_5km_latlon.txt initSFX_2019070100_720_rnetds_2019-07-01T01_2019-07-31T00_3600.nc initSFX_2019070100_720_rnetds_2019-07-01T01_2019-07-31T00_3600_regridded.nc
    institution :
    institution_id :
    license :
    https://cordex.org/data-access/cordex-cmip6-data/cordex-cmip6-terms-of-use
    mip_era :
    CMIP6
    product :
    model-output
    project_id :
    CORDEX
    references :
    source_id :
    source_type :
    ARCM
    tracking_id :
    variable_id :
    rnetds
    version_realization :
    v1-r1
    version_realization_info :
    creation_date :
    2024-11-12T10:19:39Z
    frequency :
    1hr
    StartTime :
    2019-07-01T00:00
    EndTime :
    2019-07-31T00:00
    CDO :
    Climate Data Operators version 2.0.6 (https://mpimet.mpg.de/cdo)
In [14]:
lat_rmi, lon_rmi = 50.799, 4.359
ds_rmi = ds.sel(lon=lon_rmi, lat=lat_rmi, method="nearest")

tstart = "2019-07-22T01"
tstop = "2019-07-27T00"
run_name = "initSFX"
ds_rmi_period = ds_rmi.sel(time=slice(tstart, tstop), run_name=run_name)

fig, ax = plt.subplots(layout="constrained")

ds_rmi_period.hfls.plot(ax=ax, x="time", label="Latent heat flux")
ds_rmi_period.hfss.plot(ax=ax, x="time", label="Sensible heat flux")
ds_rmi_period.rnetds.plot(ax=ax, x="time", label="Net radiation flux")

ax.set_title(f"Surface energy exchange fluxes\nbetween {tstart} and {tstop}")
ax.set_ylabel("Energy flux [W m-2]")

ax.axhline(linestyle="--", color="k", alpha=0.5, label="Flux = 0 W m-2")
ax.legend()
Out[14]:
<matplotlib.legend.Legend at 0x2007da7c290>
No description has been provided for this image

The net radiation flux is positive by day and negative by night. During daytime the net radiation flux is dominated by incoming solar radiation. This means that a positive sign for this flux denotes an energy flux going into the surface.

In [15]:
fig, ax = plt.subplots(layout="constrained")

hfss = ds_rmi_period.hfss
temp_diff = (ds_rmi_period.tas - ds_rmi_period.ts)

hfss.plot(ax=ax, x="time", label="Sensible heat flux", alpha=0.7)
hfss.where(temp_diff > 0).plot.scatter(ax=ax, x="time", label="tas - ts > 0")
hfss.where(temp_diff < 0).plot.scatter(ax=ax, x="time", label="tas - ts < 0")

ax.set_title(f"Sensible heat flux\nbetween {tstart} and {tstop}")
ax.set_ylabel("Energy flux [W m-2]")

ax.axhline(linestyle="--", color="k", alpha=0.5, label="Zero")
ax.legend()

plt.show()
No description has been provided for this image

The sensible heat flux is postive when the air temperature is smaller than the surface temperature. In that case the sensible heat flux is directed out of the surface, as it follows the direction from the warmer medium to the colder. Therefore, we can conclude that a postive sensible heat flux is defined as a flux going out of the soil.

The latent heat flux is positive by day and (almost) zero by night. During the day the evaporation of soil moisture is highest. Therefore, it follows that a positive latent heat flux is defined as going out of the surface. The latent heat flux never becomes negative.

In [16]:
fig, ax = plt.subplots(layout="constrained")

netflux = ds_rmi_period.rnetds - ds_rmi_period.hfss - ds_rmi_period.hfls
netflux.plot(ax=ax, x="time", label="Net ground flux")

ax.set_title(f"Net ground flux\nbetween {tstart} and {tstop}")
ax.set_ylabel("Energy flux [W m-2]")

ax.axhline(linestyle="--", color="k", alpha=0.5, label="Zero")
ax.legend()

plt.show()
No description has been provided for this image
In [17]:
fig, ax = plt.subplots(layout="constrained")

tas = ds_rmi_period.tas
ts = ds_rmi_period.ts

tas.plot(label="Near-Surface Air Temperature")
ts.plot(label="Surface Temperature")
ts.where(netflux > 0).plot.scatter(color="green", label="ts when netflux > 0")
ts.where(netflux < 0).plot.scatter(color="red", label="ts when netflux < 0")

ax.set_title(f"Surface energy exchange fluxes\nbetween {tstart} and {tstop}")

ax.legend()
Out[17]:
<matplotlib.legend.Legend at 0x2007d978950>
No description has been provided for this image

For the most part, the soil heats up when the net energy flux is positive, and it cools down when it is negative. However, this is not fully valid. The temperature already peaks before the flux changes sign. This can be explained by the presence of a second flux, going from the upper layer of the soil into the deeper layer.

4. Cold start vs. soil spin-up¶

In this practical, we have discussed the interaction between the surface and the atmosphere through fluxes. The simulation we discussed previously, initSFX, has been run with an initial surface state that was taken from a long-term climate simulation. This allows the soil variables to start from a state that was in equilibrium with the atmospheric variables. As these soil variables (such as temperature and moisture) are slowly-evolving, particularly the deep soil variables, the time to reach this equilibrium in a simulation can be of the order of months.

On the other hand, we have also run a simulation with a default initial surface state (we call this a cold start). This simulation is the baseline-simulation (also used in the practical about the Vesder case). For this simulation, the soil moisture and temperature variables are not yet in an equilibrium state and will hence first evolve towards this state. This will impact the atmospheric variables close to the surface. The process where a model moves towards an equilibrium state is called the spin-up period.

Investigate this by following these steps:

  • Load in the following variables for the baseline- and initSFX-simulations for the simulations starting on 1 July 2019 (720 hours):
    • tas: near-surface air temperature
    • hfss, hfls, rnetds: surface energy fluxes
    • ts: surface temperature
    • mrso: total soil moisture
    • tsl2: deep soil temperature
  • Select the data at the locations of the MOCCA stations for the heatwave period (22-26 July 2019). Plot the temperature for both simulations and compare to the observations. Which simulation performs best?
  • Plot the average over the simulation domain of all variables. How can you see the behaviour of moving to equilibrium from these plots? Can you explain the differences between these two simulations? Think about how these variables influence each other and explain how these differences are connected.

Solutions:¶

In [18]:
var_name_list = ["hfls", "hfss", "rnetds", "tas", "ts", "mrso", "tsl2"] 
run_name_list = ["baseline", "initSFX"]
ds = open_data(data_dir, var_name_list, run_name_list)
ds
Out[18]:
<xarray.Dataset>
Dimensions:      (time: 720, lon: 75, lat: 70, run_name: 2, bnds: 2)
Coordinates:
  * time         (time) datetime64[ns] 2019-07-01T01:00:00 ... 2019-07-31
  * lon          (lon) float64 2.0 2.07 2.14 2.21 2.28 ... 6.97 7.04 7.11 7.18
  * lat          (lat) float64 49.0 49.05 49.09 49.13 ... 51.97 52.02 52.06 52.1
    time_bnds    (time, bnds) datetime64[ns] 2019-07-01 ... 2019-07-31
    crs          int64 0
    rstart       <U10 '2019070100'
  * run_name     (run_name) <U8 'baseline' 'initSFX'
Dimensions without coordinates: bnds
Data variables:
    hfls         (run_name, time, lat, lon) float32 17.88 16.41 ... 0.6988
    hfss         (run_name, time, lat, lon) float32 -25.09 -20.85 ... -28.61
    rnetds       (run_name, time, lat, lon) float32 -46.82 -45.89 ... -67.98
    tas          (run_name, time, lat, lon) float32 16.06 16.37 ... 22.42 22.4
    ts           (run_name, time, lat, lon) float32 15.32 15.45 ... 21.82 21.75
    mrso         (run_name, time, lat, lon) float32 1.372 1.352 ... 0.3511
    tsl2         (run_name, time, lat, lon) float32 16.08 16.28 ... 27.41 27.35
    frac_town    (run_name, lat, lon) float32 dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
    frac_water   (run_name, lat, lon) float32 dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
    frac_nature  (run_name, lat, lon) float32 dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
    frac_sea     (run_name, lat, lon) float32 dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
Attributes: (12/33)
    CDI:                       Climate Data Interface version 2.0.6 (https://...
    source:                    ALARO-1 (CY43T2) - SURFEX v8.0
    Conventions:               CF-1.11
    activity_id:               DD
    comment:                   
    contact:                   wout.dewettinck@ugent.be
    ...                        ...
    version_realization_info:  
    creation_date:             2024-11-07T16:08:42Z
    frequency:                 1hr
    StartTime:                 2019-07-01T00:00
    EndTime:                   2019-07-31T00:00
    CDO:                       Climate Data Operators version 2.0.6 (https://...
xarray.Dataset
    • time: 720
    • lon: 75
    • lat: 70
    • run_name: 2
    • bnds: 2
    • time
      (time)
      datetime64[ns]
      2019-07-01T01:00:00 ... 2019-07-31
      axis :
      T
      standard_name :
      time
      long_name :
      time
      bounds :
      time_bnds
      array(['2019-07-01T01:00:00.000000000', '2019-07-01T02:00:00.000000000',
             '2019-07-01T03:00:00.000000000', ..., '2019-07-30T22:00:00.000000000',
             '2019-07-30T23:00:00.000000000', '2019-07-31T00:00:00.000000000'],
            dtype='datetime64[ns]')
    • lon
      (lon)
      float64
      2.0 2.07 2.14 ... 7.04 7.11 7.18
      standard_name :
      longitude
      long_name :
      longitude
      units :
      degrees_east
      axis :
      X
      array([2.  , 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7 , 2.77,
             2.84, 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4 , 3.47, 3.54, 3.61,
             3.68, 3.75, 3.82, 3.89, 3.96, 4.03, 4.1 , 4.17, 4.24, 4.31, 4.38, 4.45,
             4.52, 4.59, 4.66, 4.73, 4.8 , 4.87, 4.94, 5.01, 5.08, 5.15, 5.22, 5.29,
             5.36, 5.43, 5.5 , 5.57, 5.64, 5.71, 5.78, 5.85, 5.92, 5.99, 6.06, 6.13,
             6.2 , 6.27, 6.34, 6.41, 6.48, 6.55, 6.62, 6.69, 6.76, 6.83, 6.9 , 6.97,
             7.04, 7.11, 7.18])
    • lat
      (lat)
      float64
      49.0 49.05 49.09 ... 52.06 52.1
      standard_name :
      latitude
      long_name :
      latitude
      units :
      degrees_north
      axis :
      Y
      array([49.   , 49.045, 49.09 , 49.135, 49.18 , 49.225, 49.27 , 49.315, 49.36 ,
             49.405, 49.45 , 49.495, 49.54 , 49.585, 49.63 , 49.675, 49.72 , 49.765,
             49.81 , 49.855, 49.9  , 49.945, 49.99 , 50.035, 50.08 , 50.125, 50.17 ,
             50.215, 50.26 , 50.305, 50.35 , 50.395, 50.44 , 50.485, 50.53 , 50.575,
             50.62 , 50.665, 50.71 , 50.755, 50.8  , 50.845, 50.89 , 50.935, 50.98 ,
             51.025, 51.07 , 51.115, 51.16 , 51.205, 51.25 , 51.295, 51.34 , 51.385,
             51.43 , 51.475, 51.52 , 51.565, 51.61 , 51.655, 51.7  , 51.745, 51.79 ,
             51.835, 51.88 , 51.925, 51.97 , 52.015, 52.06 , 52.105])
    • time_bnds
      (time, bnds)
      datetime64[ns]
      2019-07-01 ... 2019-07-31
      array([['2019-07-01T00:00:00.000000000', '2019-07-01T01:00:00.000000000'],
             ['2019-07-01T01:00:00.000000000', '2019-07-01T02:00:00.000000000'],
             ['2019-07-01T02:00:00.000000000', '2019-07-01T03:00:00.000000000'],
             ...,
             ['2019-07-30T21:00:00.000000000', '2019-07-30T22:00:00.000000000'],
             ['2019-07-30T22:00:00.000000000', '2019-07-30T23:00:00.000000000'],
             ['2019-07-30T23:00:00.000000000', '2019-07-31T00:00:00.000000000']],
            dtype='datetime64[ns]')
    • crs
      ()
      int64
      0
      grid_mapping_name :
      lambert_conformal_conic
      standard_parallel :
      [51.07 51.07]
      latitude_of_projection_origin :
      0.0
      longitude_of_central_meridian :
      3.6999999999999993
      earth_radius :
      6371229.0
      array(0, dtype=int64)
    • rstart
      ()
      <U10
      '2019070100'
      array('2019070100', dtype='<U10')
    • run_name
      (run_name)
      <U8
      'baseline' 'initSFX'
      array(['baseline', 'initSFX'], dtype='<U8')
    • hfls
      (run_name, time, lat, lon)
      float32
      17.88 16.41 16.4 ... 0.6217 0.6988
      standard_name :
      surface_upward_latent_heat_flux
      long_name :
      Surface Upward Latent Heat Flux
      units :
      W m-2
      cell_methods :
      time: point
      array([[[[17.883099  , 16.408464  , 16.398582  , ...,  7.426397  ,
                 5.1502833 ,  4.0961995 ],
               [16.166409  , 12.328553  , 16.175148  , ...,  7.889462  ,
                 5.140264  ,  3.7046924 ],
               [18.145912  , 17.534527  , 17.743326  , ...,  6.898651  ,
                 4.806232  ,  4.0814075 ],
               ...,
               [52.183575  , 48.89944   , 46.40361   , ...,  5.060209  ,
                 4.32386   ,  3.547558  ],
               [52.003746  , 48.756237  , 46.33153   , ...,  4.973522  ,
                 4.1671777 ,  3.5307107 ],
               [52.028244  , 48.87928   , 46.458553  , ...,  4.6934557 ,
                 4.3500085 ,  3.568105  ]],
      
              [[ 8.828886  ,  7.588576  ,  7.632668  , ...,  6.726325  ,
                 2.850939  ,  1.652286  ],
               [ 8.952999  ,  6.871088  ,  7.7603493 , ...,  8.78549   ,
                 4.0740957 ,  2.645829  ],
               [11.009109  , 10.673198  , 10.1511965 , ...,  7.0431986 ,
                 2.5516653 ,  2.8322256 ],
      ...
               [65.18932   , 60.602615  , 57.06664   , ...,  1.0171853 ,
                 1.271093  ,  1.3400215 ],
               [64.21372   , 59.87609   , 56.058453  , ...,  1.3134444 ,
                 1.5049523 ,  1.479442  ],
               [65.032814  , 59.508865  , 56.027542  , ...,  1.6653796 ,
                 1.51856   ,  1.5713348 ]],
      
              [[39.398975  , 31.346966  , 28.00406   , ..., 18.407736  ,
                 7.3634806 ,  0.7367801 ],
               [27.76311   , 29.172684  , 25.36974   , ..., 14.993234  ,
                18.92886   ,  3.2834294 ],
               [20.477219  , 22.006979  , 20.86296   , ...,  8.419171  ,
                18.564255  ,  8.615678  ],
               ...,
               [65.44966   , 60.19456   , 55.842064  , ...,  0.5231329 ,
                 0.59498394,  0.4910763 ],
               [65.383835  , 59.757492  , 55.353577  , ...,  0.52000225,
                 0.6418467 ,  0.5143097 ],
               [64.64785   , 59.858444  , 55.552315  , ...,  0.5991925 ,
                 0.62171453,  0.69878787]]]], dtype=float32)
    • hfss
      (run_name, time, lat, lon)
      float32
      -25.09 -20.85 ... -28.26 -28.61
      standard_name :
      surface_upward_sensible_heat_flux
      long_name :
      Surface Upward Sensible Heat Flux
      units :
      W m-2
      cell_methods :
      time: point
      array([[[[-25.085686  , -20.849207  , -21.680954  , ..., -14.138099  ,
                 -8.691989  ,  -7.1291094 ],
               [-20.406752  , -18.040855  , -17.193443  , ..., -15.816497  ,
                 -8.939616  ,  -6.7583976 ],
               [-22.394379  , -21.178375  , -19.454739  , ..., -14.289347  ,
                 -8.07006   ,  -7.861857  ],
               ...,
               [-15.017487  , -16.493578  , -17.466875  , ..., -25.546333  ,
                -22.652388  , -20.39455   ],
               [-14.461549  , -15.896533  , -16.947083  , ..., -26.897625  ,
                -23.29158   , -20.514204  ],
               [-13.832977  , -15.302166  , -16.420767  , ..., -25.633818  ,
                -24.066433  , -21.281181  ]],
      
              [[-21.186451  , -17.167137  , -17.59917   , ..., -29.904154  ,
                -18.04123   , -15.215657  ],
               [-21.892912  , -16.999596  , -14.9935875 , ..., -37.266083  ,
                -26.419697  , -24.621408  ],
               [-27.432602  , -24.32281   , -21.40253   , ..., -35.360565  ,
                -19.298965  , -26.761591  ],
      ...
               [-15.878032  , -17.597582  , -18.210802  , ..., -33.935703  ,
                -30.222952  , -25.754816  ],
               [-15.784719  , -17.60823   , -18.229193  , ..., -32.743336  ,
                -30.374361  , -25.302431  ],
               [-16.24737   , -17.583225  , -18.348291  , ..., -31.11923   ,
                -30.627306  , -26.672194  ]],
      
              [[-28.016924  , -16.267612  , -11.775693  , ..., -38.469757  ,
                -28.23804   , -19.412802  ],
               [-17.128618  , -11.411778  ,  -9.163486  , ..., -33.49456   ,
                -28.802343  , -18.346699  ],
               [-17.961618  , -14.5934    , -13.053025  , ..., -27.74886   ,
                -22.096209  , -17.718386  ],
               ...,
               [-17.481972  , -18.48129   , -18.869785  , ..., -25.458572  ,
                -26.86811   , -25.202583  ],
               [-17.71172   , -18.540537  , -18.955381  , ..., -25.319359  ,
                -26.40801   , -25.53769   ],
               [-17.868673  , -18.698908  , -19.177212  , ..., -24.825699  ,
                -28.25639   , -28.61415   ]]]], dtype=float32)
    • rnetds
      (run_name, time, lat, lon)
      float32
      -46.82 -45.89 ... -70.94 -67.98
      standard_name :
      surface_net_downwelling_flux_in_air
      long_name :
      Surface Net Downwelling Radiation
      units :
      W m-2
      cell_methods :
      time: point
      array([[[[-46.823666, -45.89193 , -45.79692 , ..., -38.915   ,
                -38.81931 , -37.586803],
               [-46.395958, -45.361523, -45.728737, ..., -38.36002 ,
                -38.67388 , -37.235844],
               [-47.680763, -46.970833, -46.91722 , ..., -37.648983,
                -37.399967, -36.75277 ],
               ...,
               [-77.98904 , -76.97074 , -76.25596 , ..., -66.685356,
                -65.91274 , -65.2535  ],
               [-77.976105, -77.0265  , -76.310295, ..., -66.707634,
                -66.17219 , -65.52668 ],
               [-77.927704, -76.98079 , -76.24073 , ..., -66.629135,
                -66.60518 , -66.02028 ]],
      
              [[-43.54926 , -42.810963, -43.155807, ..., -33.861683,
                -31.665071, -26.986204],
               [-42.893982, -42.408043, -42.565506, ..., -34.88393 ,
                -33.62235 , -29.90353 ],
               [-43.844864, -43.43623 , -43.392597, ..., -34.319145,
                -32.451202, -31.70051 ],
      ...
               [-43.945404, -47.441322, -50.511143, ..., -64.8485  ,
                -63.49167 , -63.974293],
               [-43.656532, -43.925266, -49.35758 , ..., -64.44926 ,
                -60.035362, -60.57732 ],
               [-44.1106  , -42.162247, -46.97086 , ..., -63.68734 ,
                -59.751858, -58.465004]],
      
              [[-38.55018 , -38.338615, -37.762413, ..., -57.14035 ,
                -60.950058, -61.148296],
               [-37.78855 , -37.973946, -36.640015, ..., -56.64265 ,
                -56.192776, -59.495995],
               [-37.032112, -37.25    , -36.293865, ..., -58.328087,
                -54.41279 , -56.674667],
               ...,
               [-42.425602, -46.57183 , -46.571785, ..., -74.65824 ,
                -72.18467 , -68.44672 ],
               [-42.86252 , -46.240906, -48.325542, ..., -74.475876,
                -71.48833 , -68.18192 ],
               [-42.087036, -44.211895, -49.359253, ..., -74.201866,
                -70.93827 , -67.98191 ]]]], dtype=float32)
    • tas
      (run_name, time, lat, lon)
      float32
      16.06 16.37 16.44 ... 22.42 22.4
      standard_name :
      air_temperature
      long_name :
      Near-Surface Air Temperature
      units :
      °C
      cell_methods :
      time: point
      array([[[[16.057404 , 16.372131 , 16.438934 , ..., 21.920593 ,
                21.848877 , 21.765472 ],
               [15.78772  , 16.23581  , 16.372894 , ..., 21.848297 ,
                21.80075  , 21.571655 ],
               [15.647156 , 15.872345 , 15.989044 , ..., 21.915161 ,
                21.909576 , 21.616882 ],
               ...,
               [16.757385 , 16.757385 , 16.736908 , ..., 16.120575 ,
                16.084991 , 15.990326 ],
               [16.731903 , 16.709595 , 16.686432 , ..., 16.094482 ,
                16.053802 , 15.997284 ],
               [16.7016   , 16.689331 , 16.677368 , ..., 16.1521   ,
                16.106537 , 16.041138 ]],
      
              [[15.196564 , 15.499176 , 15.583862 , ..., 20.41684  ,
                20.218628 , 20.270355 ],
               [14.924774 , 15.392914 , 15.469421 , ..., 20.432343 ,
                20.266235 , 20.268646 ],
               [14.790131 , 14.99408  , 15.062256 , ..., 20.552734 ,
                20.35727  , 20.35263  ],
      ...
               [16.216095 , 16.11905  , 16.016815 , ..., 22.767761 ,
                22.76004  , 22.804413 ],
               [16.22992  , 16.114288 , 16.006195 , ..., 22.835266 ,
                22.770569 , 22.79718  ],
               [16.244781 , 16.13913  , 16.041107 , ..., 22.972412 ,
                22.88916  , 22.815887 ]],
      
              [[15.33606  , 15.695007 , 15.769745 , ..., 18.748108 ,
                18.754639 , 18.856812 ],
               [15.235565 , 15.6701355, 15.754608 , ..., 18.619995 ,
                18.09726  , 18.267365 ],
               [15.099701 , 15.290375 , 15.346985 , ..., 18.702698 ,
                17.97232  , 17.861328 ],
               ...,
               [16.31543  , 16.203125 , 16.089508 , ..., 22.223145 ,
                22.257202 , 22.303864 ],
               [16.326172 , 16.196716 , 16.081085 , ..., 22.256073 ,
                22.297394 , 22.34018  ],
               [16.338715 , 16.219025 , 16.1167   , ..., 22.320404 ,
                22.42212  , 22.40445  ]]]], dtype=float32)
    • ts
      (run_name, time, lat, lon)
      float32
      15.32 15.45 15.51 ... 21.82 21.75
      standard_name :
      surface_temperature
      long_name :
      Surface Temperature
      units :
      °C
      cell_methods :
      time: point
      array([[[[15.319031 , 15.452179 , 15.512238 , ..., 20.83194  ,
                20.840515 , 20.617584 ],
               [14.997955 , 15.172607 , 15.360321 , ..., 20.712036 ,
                20.804321 , 20.455597 ],
               [14.987488 , 15.092224 , 15.213593 , ..., 20.59784  ,
                20.710907 , 20.467133 ],
               ...,
               [15.736176 , 15.610718 , 15.507904 , ..., 14.870392 ,
                14.753693 , 14.619507 ],
               [15.739777 , 15.599274 , 15.490082 , ..., 14.811798 ,
                14.737549 , 14.623047 ],
               [15.743103 , 15.611908 , 15.509216 , ..., 14.788147 ,
                14.823242 , 14.710999 ]],
      
              [[14.369843 , 14.458649 , 14.509369 , ..., 19.300049 ,
                19.070862 , 18.811676 ],
               [14.027252 , 14.272186 , 14.3454895, ..., 19.321411 ,
                19.131317 , 18.811737 ],
               [13.982513 , 14.104614 , 14.164429 , ..., 19.19577  ,
                18.960266 , 18.848267 ],
      ...
               [15.742493 , 15.611694 , 15.508423 , ..., 22.05539  ,
                21.984314 , 22.010223 ],
               [15.74881  , 15.60025  , 15.4904785, ..., 22.137726 ,
                21.99353  , 22.030396 ],
               [15.754242 , 15.6128845, 15.509186 , ..., 22.230316 ,
                22.133698 , 22.05249  ]],
      
              [[14.861237 , 15.306152 , 15.5383   , ..., 17.834045 ,
                18.138458 , 18.251556 ],
               [14.8107605, 15.339539 , 15.444305 , ..., 17.800629 ,
                17.298431 , 17.655365 ],
               [14.650726 , 14.916534 , 15.009064 , ..., 17.969147 ,
                17.094177 , 17.130066 ],
               ...,
               [15.742798 , 15.611542 , 15.50824  , ..., 21.724548 ,
                21.672699 , 21.663666 ],
               [15.749207 , 15.5998535, 15.490448 , ..., 21.751251 ,
                21.697205 , 21.702942 ],
               [15.754089 , 15.612671 , 15.509308 , ..., 21.761902 ,
                21.818665 , 21.746521 ]]]], dtype=float32)
    • mrso
      (run_name, time, lat, lon)
      float32
      1.372 1.352 1.312 ... 0.2906 0.3511
      standard_name :
      mass_content_of_water_in_soil
      long_name :
      Total Soil Moisture Content
      units :
      kg m-2
      cell_methods :
      time: point
      array([[[[1.3723519 , 1.3518302 , 1.3124844 , ..., 1.3498751 ,
                1.3871647 , 1.3997653 ],
               [1.3662325 , 1.352333  , 1.3214624 , ..., 1.3818966 ,
                1.3456084 , 1.3885763 ],
               [1.3542373 , 1.3501213 , 1.3444369 , ..., 1.3295128 ,
                1.3432341 , 1.3901093 ],
               ...,
               [1.3026366 , 1.3026366 , 1.3026366 , ..., 1.260604  ,
                1.3066583 , 1.3611754 ],
               [1.3026366 , 1.3026366 , 1.3026366 , ..., 1.3276476 ,
                1.3099123 , 1.339452  ],
               [1.3026366 , 1.3026366 , 1.3026366 , ..., 1.239538  ,
                1.1971728 , 1.2266488 ]],
      
              [[1.3683081 , 1.3458809 , 1.3059134 , ..., 1.3460159 ,
                1.3845576 , 1.3972605 ],
               [1.3615617 , 1.3458235 , 1.3144469 , ..., 1.3792922 ,
                1.3416305 , 1.3857379 ],
               [1.3470684 , 1.3431122 , 1.3376002 , ..., 1.3231318 ,
                1.3383353 , 1.3872596 ],
      ...
               [0.61933935, 0.61933935, 0.61933935, ..., 0.383682  ,
                0.45988002, 0.5484298 ],
               [0.61933935, 0.61933935, 0.61933935, ..., 0.48856997,
                0.46711284, 0.5206815 ],
               [0.61933935, 0.61933935, 0.61933935, ..., 0.35430625,
                0.2893454 , 0.3497354 ]],
      
              [[0.78621656, 0.6908475 , 0.6176429 , ..., 0.6043805 ,
                0.6575278 , 0.6691792 ],
               [0.7618715 , 0.67757374, 0.63749605, ..., 0.66245455,
                0.59695053, 0.65227664],
               [0.67633355, 0.6715656 , 0.66530794, ..., 0.55670154,
                0.582105  , 0.6570184 ],
               ...,
               [0.6208111 , 0.6208111 , 0.6208111 , ..., 0.38518745,
                0.46158227, 0.55035466],
               [0.6208111 , 0.6208111 , 0.6208111 , ..., 0.49029955,
                0.46881932, 0.52257097],
               [0.6208111 , 0.6208111 , 0.6208111 , ..., 0.3557392 ,
                0.2905858 , 0.35112247]]]], dtype=float32)
    • tsl2
      (run_name, time, lat, lon)
      float32
      16.08 16.28 16.35 ... 27.41 27.35
      standard_name :
      soil_temperature_layer_2
      long_name :
      Temperature of Soil Layer 2
      units :
      °C
      cell_methods :
      time: point
      array([[[[16.075134 , 16.282196 , 16.345459 , ..., 16.365723 ,
                16.230865 , 16.000488 ],
               [15.917908 , 16.16275  , 16.287445 , ..., 16.317993 ,
                16.21933  , 15.901703 ],
               [15.906891 , 16.011292 , 16.087585 , ..., 16.327606 ,
                16.320557 , 15.949158 ],
               ...,
               [14.37207  , 14.37207  , 14.37207  , ..., 16.027954 ,
                15.983948 , 15.922913 ],
               [14.37207  , 14.37207  , 14.37207  , ..., 16.036926 ,
                16.016144 , 15.955261 ],
               [14.37207  , 14.37207  , 14.37207  , ..., 16.003082 ,
                16.023132 , 15.955139 ]],
      
              [[16.02591  , 16.231567 , 16.295227 , ..., 16.511902 ,
                16.376404 , 16.145569 ],
               [15.859772 , 16.109802 , 16.231873 , ..., 16.464539 ,
                16.3656   , 16.046356 ],
               [15.845337 , 15.951813 , 16.028564 , ..., 16.426056 ,
                16.458008 , 16.09317  ],
      ...
               [21.480804 , 21.480804 , 21.480804 , ..., 27.702118 ,
                27.842865 , 28.009521 ],
               [21.480804 , 21.480804 , 21.480804 , ..., 27.689178 ,
                27.756897 , 27.861603 ],
               [21.480804 , 21.480804 , 21.480804 , ..., 27.681763 ,
                27.640259 , 27.577576 ]],
      
              [[20.099396 , 20.27774  , 20.231659 , ..., 25.85196  ,
                25.812225 , 26.101227 ],
               [20.153595 , 20.160095 , 20.153687 , ..., 25.643402 ,
                25.472626 , 25.686035 ],
               [20.243713 , 20.217834 , 20.10434  , ..., 25.675995 ,
                25.559357 , 25.463226 ],
               ...,
               [21.250916 , 21.250916 , 21.250916 , ..., 27.468964 ,
                27.599487 , 27.758392 ],
               [21.250916 , 21.250916 , 21.250916 , ..., 27.457703 ,
                27.517456 , 27.617493 ],
               [21.250916 , 21.250916 , 21.250916 , ..., 27.451904 ,
                27.41043  , 27.34607  ]]]], dtype=float32)
    • frac_town
      (run_name, lat, lon)
      float32
      dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
      standard_name :
      town_fraction
      long_name :
      Town Fraction
      units :
      %
      Array Chunk
      Bytes 41.02 kiB 20.51 kiB
      Shape (2, 70, 75) (1, 70, 75)
      Dask graph 2 chunks in 7 graph layers
      Data type float32 numpy.ndarray
      75 70 2
    • frac_water
      (run_name, lat, lon)
      float32
      dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
      standard_name :
      water_fraction
      long_name :
      Water Fraction
      units :
      %
      Array Chunk
      Bytes 41.02 kiB 20.51 kiB
      Shape (2, 70, 75) (1, 70, 75)
      Dask graph 2 chunks in 7 graph layers
      Data type float32 numpy.ndarray
      75 70 2
    • frac_nature
      (run_name, lat, lon)
      float32
      dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
      standard_name :
      nature_fraction
      long_name :
      Nature Fraction
      units :
      %
      Array Chunk
      Bytes 41.02 kiB 20.51 kiB
      Shape (2, 70, 75) (1, 70, 75)
      Dask graph 2 chunks in 7 graph layers
      Data type float32 numpy.ndarray
      75 70 2
    • frac_sea
      (run_name, lat, lon)
      float32
      dask.array<chunksize=(1, 70, 75), meta=np.ndarray>
      standard_name :
      sea_fraction
      long_name :
      Sea Fraction
      units :
      %
      Array Chunk
      Bytes 41.02 kiB 20.51 kiB
      Shape (2, 70, 75) (1, 70, 75)
      Dask graph 2 chunks in 7 graph layers
      Data type float32 numpy.ndarray
      75 70 2
    • time
      PandasIndex
      PandasIndex(DatetimeIndex(['2019-07-01 01:00:00', '2019-07-01 02:00:00',
                     '2019-07-01 03:00:00', '2019-07-01 04:00:00',
                     '2019-07-01 05:00:00', '2019-07-01 06:00:00',
                     '2019-07-01 07:00:00', '2019-07-01 08:00:00',
                     '2019-07-01 09:00:00', '2019-07-01 10:00:00',
                     ...
                     '2019-07-30 15:00:00', '2019-07-30 16:00:00',
                     '2019-07-30 17:00:00', '2019-07-30 18:00:00',
                     '2019-07-30 19:00:00', '2019-07-30 20:00:00',
                     '2019-07-30 21:00:00', '2019-07-30 22:00:00',
                     '2019-07-30 23:00:00', '2019-07-31 00:00:00'],
                    dtype='datetime64[ns]', name='time', length=720, freq=None))
    • lon
      PandasIndex
      PandasIndex(Index([               2.0,               2.07,               2.14,
                           2.21, 2.2800000000000002,               2.35,
                           2.42,               2.49,               2.56,
                           2.63,                2.7,               2.77,
                           2.84,               2.91,               2.98,
             3.0500000000000003,               3.12,               3.19,
             3.2600000000000002,               3.33, 3.4000000000000004,
                           3.47,               3.54, 3.6100000000000003,
                           3.68,               3.75, 3.8200000000000003,
                           3.89,               3.96,               4.03,
             4.1000000000000005,               4.17,               4.24,
             4.3100000000000005,               4.38,               4.45,
             4.5200000000000005,               4.59,               4.66,
                           4.73,  4.800000000000001,               4.87,
                           4.94,  5.010000000000001,               5.08,
                           5.15,  5.220000000000001,               5.29,
                           5.36,  5.430000000000001,                5.5,
                           5.57,  5.640000000000001,               5.71,
                           5.78, 5.8500000000000005,               5.92,
                           5.99, 6.0600000000000005,  6.130000000000001,
                            6.2, 6.2700000000000005,  6.340000000000001,
                           6.41,               6.48,  6.550000000000001,
                           6.62,               6.69,  6.760000000000001,
                           6.83,                6.9,  6.970000000000001,
              7.040000000000001,               7.11,  7.180000000000001],
            dtype='float64', name='lon'))
    • lat
      PandasIndex
      PandasIndex(Index([  49.0, 49.045,  49.09, 49.135,  49.18, 49.225,  49.27, 49.315,  49.36,
             49.405,  49.45, 49.495,  49.54, 49.585,  49.63, 49.675,  49.72, 49.765,
              49.81, 49.855,   49.9, 49.945,  49.99, 50.035,  50.08, 50.125,  50.17,
             50.215,  50.26, 50.305,  50.35, 50.395,  50.44, 50.485,  50.53, 50.575,
              50.62, 50.665,  50.71, 50.755,   50.8, 50.845,  50.89, 50.935,  50.98,
             51.025,  51.07, 51.115,  51.16, 51.205,  51.25, 51.295,  51.34, 51.385,
              51.43, 51.475,  51.52, 51.565,  51.61, 51.655,   51.7, 51.745,  51.79,
             51.835,  51.88, 51.925,  51.97, 52.015,  52.06, 52.105],
            dtype='float64', name='lat'))
    • run_name
      PandasIndex
      PandasIndex(Index(['baseline', 'initSFX'], dtype='object', name='run_name'))
  • CDI :
    Climate Data Interface version 2.0.6 (https://mpimet.mpg.de/cdi)
    source :
    ALARO-1 (CY43T2) - SURFEX v8.0
    Conventions :
    CF-1.11
    activity_id :
    DD
    comment :
    contact :
    wout.dewettinck@ugent.be
    domain :
    domain_id :
    driving_experiment :
    reanalysis simulation of the recent past
    driving_experiment_id :
    evaluation
    driving_institution_id :
    ECMWF
    driving_source_id :
    ERA5
    driving_variant_label :
    r1i1p1f1
    grid :
    Lambert conic conformal with 1.3 km grid spacing
    history :
    Thu Nov 07 17:12:31 2024: cdo -v remapcon,/dodrio/scratch/users/vsc45263/wout/CompPhys/simulations/src/grids/belgium_5km_latlon.txt baseline_2019070100_720_hfls_2019-07-01T01_2019-07-31T00_3600.nc baseline_2019070100_720_hfls_2019-07-01T01_2019-07-31T00_3600_regridded.nc
    institution :
    institution_id :
    license :
    https://cordex.org/data-access/cordex-cmip6-data/cordex-cmip6-terms-of-use
    mip_era :
    CMIP6
    product :
    model-output
    project_id :
    CORDEX
    references :
    source_id :
    source_type :
    ARCM
    tracking_id :
    variable_id :
    hfls
    version_realization :
    v1-r1
    version_realization_info :
    creation_date :
    2024-11-07T16:08:42Z
    frequency :
    1hr
    StartTime :
    2019-07-01T00:00
    EndTime :
    2019-07-31T00:00
    CDO :
    Climate Data Operators version 2.0.6 (https://mpimet.mpg.de/cdo)
In [19]:
tstart = "2019-07-22T01"
tstop = "2019-07-27T00"
obs = xr.open_dataset(f"{data_dir}/MOCCA_tas_{tstart}_{tstop}.nc", engine="netcdf4")
obs
Out[19]:
<xarray.Dataset>
Dimensions:   (time: 120, location: 6)
Coordinates:
    index     (time) int64 ...
    year      (time) int64 ...
    month     (time) int64 ...
    day       (time) int64 ...
    hour      (time) int64 ...
  * time      (time) datetime64[ns] 2019-07-22T01:00:00 ... 2019-07-27
    lon       (location) float64 ...
    lat       (location) float64 ...
  * location  (location) <U13 'Provinciehuis' 'Melle' ... 'Sint-Bavo'
Data variables:
    tas       (location, time) float64 ...
xarray.Dataset
    • time: 120
    • location: 6
    • index
      (time)
      int64
      ...
      [120 values with dtype=int64]
    • year
      (time)
      int64
      ...
      [120 values with dtype=int64]
    • month
      (time)
      int64
      ...
      [120 values with dtype=int64]
    • day
      (time)
      int64
      ...
      [120 values with dtype=int64]
    • hour
      (time)
      int64
      ...
      [120 values with dtype=int64]
    • time
      (time)
      datetime64[ns]
      2019-07-22T01:00:00 ... 2019-07-27
      array(['2019-07-22T01:00:00.000000000', '2019-07-22T02:00:00.000000000',
             '2019-07-22T03:00:00.000000000', '2019-07-22T04:00:00.000000000',
             '2019-07-22T05:00:00.000000000', '2019-07-22T06:00:00.000000000',
             '2019-07-22T07:00:00.000000000', '2019-07-22T08:00:00.000000000',
             '2019-07-22T09:00:00.000000000', '2019-07-22T10:00:00.000000000',
             '2019-07-22T11:00:00.000000000', '2019-07-22T12:00:00.000000000',
             '2019-07-22T13:00:00.000000000', '2019-07-22T14:00:00.000000000',
             '2019-07-22T15:00:00.000000000', '2019-07-22T16:00:00.000000000',
             '2019-07-22T17:00:00.000000000', '2019-07-22T18:00:00.000000000',
             '2019-07-22T19:00:00.000000000', '2019-07-22T20:00:00.000000000',
             '2019-07-22T21:00:00.000000000', '2019-07-22T22:00:00.000000000',
             '2019-07-22T23:00:00.000000000', '2019-07-23T00:00:00.000000000',
             '2019-07-23T01:00:00.000000000', '2019-07-23T02:00:00.000000000',
             '2019-07-23T03:00:00.000000000', '2019-07-23T04:00:00.000000000',
             '2019-07-23T05:00:00.000000000', '2019-07-23T06:00:00.000000000',
             '2019-07-23T07:00:00.000000000', '2019-07-23T08:00:00.000000000',
             '2019-07-23T09:00:00.000000000', '2019-07-23T10:00:00.000000000',
             '2019-07-23T11:00:00.000000000', '2019-07-23T12:00:00.000000000',
             '2019-07-23T13:00:00.000000000', '2019-07-23T14:00:00.000000000',
             '2019-07-23T15:00:00.000000000', '2019-07-23T16:00:00.000000000',
             '2019-07-23T17:00:00.000000000', '2019-07-23T18:00:00.000000000',
             '2019-07-23T19:00:00.000000000', '2019-07-23T20:00:00.000000000',
             '2019-07-23T21:00:00.000000000', '2019-07-23T22:00:00.000000000',
             '2019-07-23T23:00:00.000000000', '2019-07-24T00:00:00.000000000',
             '2019-07-24T01:00:00.000000000', '2019-07-24T02:00:00.000000000',
             '2019-07-24T03:00:00.000000000', '2019-07-24T04:00:00.000000000',
             '2019-07-24T05:00:00.000000000', '2019-07-24T06:00:00.000000000',
             '2019-07-24T07:00:00.000000000', '2019-07-24T08:00:00.000000000',
             '2019-07-24T09:00:00.000000000', '2019-07-24T10:00:00.000000000',
             '2019-07-24T11:00:00.000000000', '2019-07-24T12:00:00.000000000',
             '2019-07-24T13:00:00.000000000', '2019-07-24T14:00:00.000000000',
             '2019-07-24T15:00:00.000000000', '2019-07-24T16:00:00.000000000',
             '2019-07-24T17:00:00.000000000', '2019-07-24T18:00:00.000000000',
             '2019-07-24T19:00:00.000000000', '2019-07-24T20:00:00.000000000',
             '2019-07-24T21:00:00.000000000', '2019-07-24T22:00:00.000000000',
             '2019-07-24T23:00:00.000000000', '2019-07-25T00:00:00.000000000',
             '2019-07-25T01:00:00.000000000', '2019-07-25T02:00:00.000000000',
             '2019-07-25T03:00:00.000000000', '2019-07-25T04:00:00.000000000',
             '2019-07-25T05:00:00.000000000', '2019-07-25T06:00:00.000000000',
             '2019-07-25T07:00:00.000000000', '2019-07-25T08:00:00.000000000',
             '2019-07-25T09:00:00.000000000', '2019-07-25T10:00:00.000000000',
             '2019-07-25T11:00:00.000000000', '2019-07-25T12:00:00.000000000',
             '2019-07-25T13:00:00.000000000', '2019-07-25T14:00:00.000000000',
             '2019-07-25T15:00:00.000000000', '2019-07-25T16:00:00.000000000',
             '2019-07-25T17:00:00.000000000', '2019-07-25T18:00:00.000000000',
             '2019-07-25T19:00:00.000000000', '2019-07-25T20:00:00.000000000',
             '2019-07-25T21:00:00.000000000', '2019-07-25T22:00:00.000000000',
             '2019-07-25T23:00:00.000000000', '2019-07-26T00:00:00.000000000',
             '2019-07-26T01:00:00.000000000', '2019-07-26T02:00:00.000000000',
             '2019-07-26T03:00:00.000000000', '2019-07-26T04:00:00.000000000',
             '2019-07-26T05:00:00.000000000', '2019-07-26T06:00:00.000000000',
             '2019-07-26T07:00:00.000000000', '2019-07-26T08:00:00.000000000',
             '2019-07-26T09:00:00.000000000', '2019-07-26T10:00:00.000000000',
             '2019-07-26T11:00:00.000000000', '2019-07-26T12:00:00.000000000',
             '2019-07-26T13:00:00.000000000', '2019-07-26T14:00:00.000000000',
             '2019-07-26T15:00:00.000000000', '2019-07-26T16:00:00.000000000',
             '2019-07-26T17:00:00.000000000', '2019-07-26T18:00:00.000000000',
             '2019-07-26T19:00:00.000000000', '2019-07-26T20:00:00.000000000',
             '2019-07-26T21:00:00.000000000', '2019-07-26T22:00:00.000000000',
             '2019-07-26T23:00:00.000000000', '2019-07-27T00:00:00.000000000'],
            dtype='datetime64[ns]')
    • lon
      (location)
      float64
      ...
      [6 values with dtype=float64]
    • lat
      (location)
      float64
      ...
      [6 values with dtype=float64]
    • location
      (location)
      <U13
      'Provinciehuis' ... 'Sint-Bavo'
      array(['Provinciehuis', 'Melle', 'Honda', 'Wondelgem', 'Plantentuin',
             'Sint-Bavo'], dtype='<U13')
    • tas
      (location, time)
      float64
      ...
      standard_name :
      air_temperature
      long_name :
      Near-Surface Air Temperature
      units :
      °C
      cell_methods :
      time: point
      [720 values with dtype=float64]
    • time
      PandasIndex
      PandasIndex(DatetimeIndex(['2019-07-22 01:00:00', '2019-07-22 02:00:00',
                     '2019-07-22 03:00:00', '2019-07-22 04:00:00',
                     '2019-07-22 05:00:00', '2019-07-22 06:00:00',
                     '2019-07-22 07:00:00', '2019-07-22 08:00:00',
                     '2019-07-22 09:00:00', '2019-07-22 10:00:00',
                     ...
                     '2019-07-26 15:00:00', '2019-07-26 16:00:00',
                     '2019-07-26 17:00:00', '2019-07-26 18:00:00',
                     '2019-07-26 19:00:00', '2019-07-26 20:00:00',
                     '2019-07-26 21:00:00', '2019-07-26 22:00:00',
                     '2019-07-26 23:00:00', '2019-07-27 00:00:00'],
                    dtype='datetime64[ns]', name='time', length=120, freq=None))
    • location
      PandasIndex
      PandasIndex(Index(['Provinciehuis', 'Melle', 'Honda', 'Wondelgem', 'Plantentuin',
             'Sint-Bavo'],
            dtype='object', name='location'))
In [20]:
ds_locations_list = list()

for location in obs.location:
    lat = obs.lat.sel(location=location).values
    lon = obs.lon.sel(location=location).values
    ds_location = ds.sel(lat=lat, lon=lon, method="nearest")
    ds_locations_list.append(ds_location.assign_coords(location=location.values))

ds_locations = xr.concat(ds_locations_list, dim="location")
ds_locations
Out[20]:
<xarray.Dataset>
Dimensions:      (time: 720, location: 6, run_name: 2, bnds: 2)
Coordinates:
  * time         (time) datetime64[ns] 2019-07-01T01:00:00 ... 2019-07-31
    lon          (location) float64 3.75 3.82 3.75 3.68 3.75 3.75
    lat          (location) float64 51.07 50.98 51.12 51.07 51.02 51.07
    time_bnds    (time, bnds) datetime64[ns] 2019-07-01 ... 2019-07-31
    crs          int64 0
    rstart       <U10 '2019070100'
  * run_name     (run_name) <U8 'baseline' 'initSFX'
  * location     (location) <U13 'Provinciehuis' 'Melle' ... 'Sint-Bavo'
Dimensions without coordinates: bnds
Data variables:
    hfls         (location, run_name, time) float32 5.119 0.9933 ... 4.356 4.638
    hfss         (location, run_name, time) float32 -19.37 -18.89 ... 3.528
    rnetds       (location, run_name, time) float32 -42.57 -39.7 ... -43.19
    tas          (location, run_name, time) float32 15.9 15.42 ... 17.6 17.24
    ts           (location, run_name, time) float32 14.83 14.29 ... 17.68 17.3
    mrso         (location, run_name, time) float32 1.173 1.144 ... 0.3184
    tsl2         (location, run_name, time) float32 15.19 14.72 ... 23.07 22.83
    frac_town    (location, run_name) float32 dask.array<chunksize=(1, 1), meta=np.ndarray>
    frac_water   (location, run_name) float32 dask.array<chunksize=(1, 1), meta=np.ndarray>
    frac_nature  (location, run_name) float32 dask.array<chunksize=(1, 1), meta=np.ndarray>
    frac_sea     (location, run_name) float32 dask.array<chunksize=(1, 1), meta=np.ndarray>
Attributes: (12/33)
    CDI:                       Climate Data Interface version 2.0.6 (https://...
    source:                    ALARO-1 (CY43T2) - SURFEX v8.0
    Conventions:               CF-1.11
    activity_id:               DD
    comment:                   
    contact:                   wout.dewettinck@ugent.be
    ...                        ...
    version_realization_info:  
    creation_date:             2024-11-07T16:08:42Z
    frequency:                 1hr
    StartTime:                 2019-07-01T00:00
    EndTime:                   2019-07-31T00:00
    CDO:                       Climate Data Operators version 2.0.6 (https://...
xarray.Dataset
    • time: 720
    • location: 6
    • run_name: 2
    • bnds: 2
    • time
      (time)
      datetime64[ns]
      2019-07-01T01:00:00 ... 2019-07-31
      axis :
      T
      standard_name :
      time
      long_name :
      time
      bounds :
      time_bnds
      array(['2019-07-01T01:00:00.000000000', '2019-07-01T02:00:00.000000000',
             '2019-07-01T03:00:00.000000000', ..., '2019-07-30T22:00:00.000000000',
             '2019-07-30T23:00:00.000000000', '2019-07-31T00:00:00.000000000'],
            dtype='datetime64[ns]')
    • lon
      (location)
      float64
      3.75 3.82 3.75 3.68 3.75 3.75
      standard_name :
      longitude
      long_name :
      longitude
      units :
      degrees_east
      axis :
      X
      array([3.75, 3.82, 3.75, 3.68, 3.75, 3.75])
    • lat
      (location)
      float64
      51.07 50.98 51.12 51.07 51.02 51.07
      standard_name :
      latitude
      long_name :
      latitude
      units :
      degrees_north
      axis :
      Y
      array([51.07 , 50.98 , 51.115, 51.07 , 51.025, 51.07 ])
    • time_bnds
      (time, bnds)
      datetime64[ns]
      2019-07-01 ... 2019-07-31
      array([['2019-07-01T00:00:00.000000000', '2019-07-01T01:00:00.000000000'],
             ['2019-07-01T01:00:00.000000000', '2019-07-01T02:00:00.000000000'],
             ['2019-07-01T02:00:00.000000000', '2019-07-01T03:00:00.000000000'],
             ...,
             ['2019-07-30T21:00:00.000000000', '2019-07-30T22:00:00.000000000'],
             ['2019-07-30T22:00:00.000000000', '2019-07-30T23:00:00.000000000'],
             ['2019-07-30T23:00:00.000000000', '2019-07-31T00:00:00.000000000']],
            dtype='datetime64[ns]')
    • crs
      ()
      int64
      0
      grid_mapping_name :
      lambert_conformal_conic
      standard_parallel :
      [51.07 51.07]
      latitude_of_projection_origin :
      0.0
      longitude_of_central_meridian :
      3.6999999999999993
      earth_radius :
      6371229.0
      array(0, dtype=int64)
    • rstart
      ()
      <U10
      '2019070100'
      array('2019070100', dtype='<U10')
    • run_name
      (run_name)
      <U8
      'baseline' 'initSFX'
      array(['baseline', 'initSFX'], dtype='<U8')
    • location
      (location)
      <U13
      'Provinciehuis' ... 'Sint-Bavo'
      array(['Provinciehuis', 'Melle', 'Honda', 'Wondelgem', 'Plantentuin',
             'Sint-Bavo'], dtype='<U13')
    • hfls
      (location, run_name, time)
      float32
      5.119 0.9933 -3.153 ... 4.356 4.638
      standard_name :
      surface_upward_latent_heat_flux
      long_name :
      Surface Upward Latent Heat Flux
      units :
      W m-2
      cell_methods :
      time: point
      array([[[ 5.118818  ,  0.9933388 , -3.1533506 , ..., 53.052525  ,
               46.60464   , 35.832996  ],
              [ 3.1138794 ,  2.583457  ,  2.8238928 , ...,  3.7522295 ,
                4.355715  ,  4.638247  ]],
      
             [[11.65947   ,  5.0934277 ,  2.4054277 , ..., 67.05216   ,
               52.85649   , 41.00848   ],
              [ 0.5927981 ,  0.5076528 ,  0.52256763, ...,  2.963831  ,
                4.5308647 ,  3.9723887 ]],
      
             [[12.071919  ,  3.247132  , -0.91547096, ..., 54.279156  ,
               53.632046  , 40.59617   ],
              [ 1.4398888 ,  1.1205165 ,  1.1313415 , ...,  2.1283011 ,
                2.106646  ,  2.2126749 ]],
      
             [[ 5.1930065 ,  0.80072844, -3.5438032 , ..., 55.594887  ,
               43.443783  , 32.795227  ],
              [ 2.78858   ,  2.1378582 ,  2.2184198 , ...,  5.6246157 ,
                5.4474277 ,  4.8144617 ]],
      
             [[ 6.4218454 ,  2.1837757 , -0.4594567 , ..., 58.077255  ,
               45.563812  , 34.67576   ],
              [ 2.5963883 ,  2.4904056 ,  2.677825  , ...,  2.937027  ,
                3.8109226 ,  3.9653604 ]],
      
             [[ 5.118818  ,  0.9933388 , -3.1533506 , ..., 53.052525  ,
               46.60464   , 35.832996  ],
              [ 3.1138794 ,  2.583457  ,  2.8238928 , ...,  3.7522295 ,
                4.355715  ,  4.638247  ]]], dtype=float32)
    • hfss
      (location, run_name, time)
      float32
      -19.37 -18.89 ... 2.663 3.528
      standard_name :
      surface_upward_sensible_heat_flux
      long_name :
      Surface Upward Sensible Heat Flux
      units :
      W m-2
      cell_methods :
      time: point
      array([[[-19.3654    , -18.890806  , -23.633976  , ..., -27.21371   ,
               -22.303682  , -27.50704   ],
              [  7.9476514 ,   5.96813   ,   0.9500355 , ...,   2.9233634 ,
                 2.6632998 ,   3.5280557 ]],
      
             [[-27.334343  , -27.427713  , -32.35723   , ..., -40.29395   ,
               -43.220387  , -53.53072   ],
              [ -0.95700884,   0.23141555,  -5.1541085 , ...,  -9.512396  ,
               -12.616727  ,  -9.605654  ]],
      
             [[-22.276678  , -21.668543  , -26.800713  , ..., -42.184418  ,
               -35.88641   , -40.83992   ],
              [  2.4688299 ,   2.8271756 ,  -1.6495485 , ...,  -3.4793544 ,
                -3.4245124 ,  -0.064566  ]],
      
             [[-19.53977   , -18.8096    , -23.37133   , ..., -35.638428  ,
               -28.293375  , -33.366096  ],
              [  2.748151  ,   1.3784524 ,  -3.4366899 , ...,  -2.4575837 ,
                -2.1418364 ,  -1.7924584 ]],
      
             [[-18.941566  , -18.730633  , -23.211649  , ..., -30.199587  ,
               -25.703072  , -32.446846  ],
              [  6.0827847 ,   3.895379  ,  -1.5615009 , ...,   0.27618623,
                 0.51129955,  -0.21368897]],
      
             [[-19.3654    , -18.890806  , -23.633976  , ..., -27.21371   ,
               -22.303682  , -27.50704   ],
              [  7.9476514 ,   5.96813   ,   0.9500355 , ...,   2.9233634 ,
                 2.6632998 ,   3.5280557 ]]], dtype=float32)
    • rnetds
      (location, run_name, time)
      float32
      -42.57 -39.7 ... -42.39 -43.19
      standard_name :
      surface_net_downwelling_flux_in_air
      long_name :
      Surface Net Downwelling Radiation
      units :
      W m-2
      cell_methods :
      time: point
      array([[[-42.57372 , -39.70359 , -44.018658, ..., -37.56497 ,
               -37.990566, -41.899254],
              [-51.850975, -50.489857, -54.198868, ..., -44.342915,
               -42.386272, -43.189636]],
      
             [[-44.79082 , -40.774902, -45.39985 , ..., -37.576862,
               -37.48316 , -39.35501 ],
              [-50.765785, -49.46797 , -54.230953, ..., -43.46218 ,
               -33.243298, -41.32015 ]],
      
             [[-45.247543, -41.43546 , -46.77432 , ..., -38.212807,
               -37.15372 , -42.479504],
              [-51.635284, -50.249832, -55.272358, ..., -43.61322 ,
               -46.09945 , -42.439106]],
      
             [[-43.628365, -40.751152, -44.848106, ..., -31.61455 ,
               -38.15788 , -41.67374 ],
              [-51.051712, -50.114292, -53.97678 , ..., -42.019836,
               -40.93534 , -43.36564 ]],
      
             [[-42.5283  , -39.751747, -44.346104, ..., -33.161148,
               -38.35966 , -40.59586 ],
              [-51.0476  , -49.96108 , -54.166786, ..., -43.9625  ,
               -40.004604, -43.86873 ]],
      
             [[-42.57372 , -39.70359 , -44.018658, ..., -37.56497 ,
               -37.990566, -41.899254],
              [-51.850975, -50.489857, -54.198868, ..., -44.342915,
               -42.386272, -43.189636]]], dtype=float32)
    • tas
      (location, run_name, time)
      float32
      15.9 15.42 15.18 ... 17.6 17.24
      standard_name :
      air_temperature
      long_name :
      Near-Surface Air Temperature
      units :
      °C
      cell_methods :
      time: point
      array([[[15.903656 , 15.42218  , 15.181763 , ..., 16.513977 ,
               15.677856 , 15.341827 ],
              [16.665894 , 16.737915 , 16.788391 , ..., 17.89441  ,
               17.60086  , 17.239563 ]],
      
             [[15.601044 , 15.022034 , 14.784576 , ..., 15.839325 ,
               14.992859 , 14.75061  ],
              [16.261566 , 16.332794 , 16.461273 , ..., 17.370789 ,
               17.1221   , 16.792267 ]],
      
             [[15.855194 , 15.339233 , 15.07843  , ..., 16.266388 ,
               15.54007  , 15.1840515],
              [16.470215 , 16.571228 , 16.631622 , ..., 17.720032 ,
               17.521393 , 17.204163 ]],
      
             [[15.843475 , 15.326355 , 15.058289 , ..., 16.190765 ,
               15.387817 , 15.12561  ],
              [16.430634 , 16.559357 , 16.630554 , ..., 17.528503 ,
               17.289734 , 17.022919 ]],
      
             [[15.840088 , 15.289795 , 15.042786 , ..., 16.22702  ,
               15.395905 , 15.13266  ],
              [16.573608 , 16.639252 , 16.727783 , ..., 17.734406 ,
               17.4682   , 17.120087 ]],
      
             [[15.903656 , 15.42218  , 15.181763 , ..., 16.513977 ,
               15.677856 , 15.341827 ],
              [16.665894 , 16.737915 , 16.788391 , ..., 17.89441  ,
               17.60086  , 17.239563 ]]], dtype=float32)
    • ts
      (location, run_name, time)
      float32
      14.83 14.29 14.03 ... 17.68 17.3
      standard_name :
      surface_temperature
      long_name :
      Surface Temperature
      units :
      °C
      cell_methods :
      time: point
      array([[[14.826294 , 14.292755 , 14.032562 , ..., 15.739105 ,
               14.938904 , 14.497681 ],
              [17.001373 , 16.93161  , 16.740723 , ..., 17.97699  ,
               17.678833 , 17.304657 ]],
      
             [[14.958588 , 14.356812 , 14.113953 , ..., 15.231445 ,
               14.169312 , 13.801331 ],
              [16.364532 , 16.453003 , 16.450134 , ..., 17.073181 ,
               16.945282 , 16.664307 ]],
      
             [[15.081299 , 14.500977 , 14.233948 , ..., 15.316559 ,
               14.640564 , 14.260376 ],
              [16.59784  , 16.681274 , 16.595062 , ..., 17.59848  ,
               17.428986 , 17.212158 ]],
      
             [[14.875244 , 14.303864 , 14.015808 , ..., 15.3654175,
               14.597015 , 14.267822 ],
              [16.631989 , 16.653595 , 16.501892 , ..., 17.477112 ,
               17.266693 , 16.966064 ]],
      
             [[14.871887 , 14.287994 , 14.006592 , ..., 15.547211 ,
               14.679169 , 14.276001 ],
              [16.858215 , 16.787872 , 16.631561 , ..., 17.762817 ,
               17.535583 , 17.105072 ]],
      
             [[14.826294 , 14.292755 , 14.032562 , ..., 15.739105 ,
               14.938904 , 14.497681 ],
              [17.001373 , 16.93161  , 16.740723 , ..., 17.97699  ,
               17.678833 , 17.304657 ]]], dtype=float32)
    • mrso
      (location, run_name, time)
      float32
      1.173 1.144 1.125 ... 0.3178 0.3184
      standard_name :
      mass_content_of_water_in_soil
      long_name :
      Total Soil Moisture Content
      units :
      kg m-2
      cell_methods :
      time: point
      array([[[1.172704  , 1.1444665 , 1.1249683 , ..., 0.5600584 ,
               0.55624187, 0.5526171 ],
              [0.33928123, 0.3400316 , 0.34078237, ..., 0.31706166,
               0.3177913 , 0.31843862]],
      
             [[1.3606439 , 1.3519682 , 1.3435138 , ..., 0.79015523,
               0.7883556 , 0.7866293 ],
              [0.54400986, 0.5452129 , 0.54639786, ..., 0.52651554,
               0.52769023, 0.5287765 ]],
      
             [[1.2256516 , 1.2038301 , 1.1866647 , ..., 0.60486853,
               0.6017368 , 0.598757  ],
              [0.38242933, 0.38328078, 0.3841508 , ..., 0.3553345 ,
               0.35609987, 0.3568107 ]],
      
             [[1.2513978 , 1.2321364 , 1.2167192 , ..., 0.64066494,
               0.6378257 , 0.635129  ],
              [0.41323078, 0.41417617, 0.4151113 , ..., 0.3899414 ,
               0.39076447, 0.39155397]],
      
             [[1.3406757 , 1.3314633 , 1.3226802 , ..., 0.7983779 ,
               0.79575723, 0.79323983],
              [0.52647465, 0.5276796 , 0.5288632 , ..., 0.5029919 ,
               0.5041383 , 0.5052191 ]],
      
             [[1.172704  , 1.1444665 , 1.1249683 , ..., 0.5600584 ,
               0.55624187, 0.5526171 ],
              [0.33928123, 0.3400316 , 0.34078237, ..., 0.31706166,
               0.3177913 , 0.31843862]]], dtype=float32)
    • tsl2
      (location, run_name, time)
      float32
      15.19 14.72 14.3 ... 23.07 22.83
      standard_name :
      soil_temperature_layer_2
      long_name :
      Temperature of Soil Layer 2
      units :
      °C
      cell_methods :
      time: point
      array([[[15.192017, 14.717102, 14.298553, ..., 19.277039, 19.08548 ,
               18.878387],
              [25.808136, 25.425812, 25.061615, ..., 23.320618, 23.07193 ,
               22.826904]],
      
             [[15.741455, 15.695923, 15.636444, ..., 18.825653, 18.648346,
               18.45047 ],
              [26.181244, 25.781128, 25.400055, ..., 22.776337, 22.536102,
               22.300049]],
      
             [[15.662048, 15.585602, 15.502808, ..., 19.493835, 19.29834 ,
               19.08786 ],
              [25.734222, 25.35733 , 24.998688, ..., 23.556335, 23.303467,
               23.055023]],
      
             [[15.655243, 15.489166, 15.322388, ..., 18.971863, 18.786713,
               18.588593],
              [25.357025, 24.98471 , 24.631714, ..., 23.298859, 23.038635,
               22.785797]],
      
             [[15.820892, 15.774872, 15.712738, ..., 18.899628, 18.721008,
               18.524963],
              [25.889008, 25.503784, 25.137238, ..., 23.14038 , 22.89679 ,
               22.656525]],
      
             [[15.192017, 14.717102, 14.298553, ..., 19.277039, 19.08548 ,
               18.878387],
              [25.808136, 25.425812, 25.061615, ..., 23.320618, 23.07193 ,
               22.826904]]], dtype=float32)
    • frac_town
      (location, run_name)
      float32
      dask.array<chunksize=(1, 1), meta=np.ndarray>
      standard_name :
      town_fraction
      long_name :
      Town Fraction
      units :
      %
      Array Chunk
      Bytes 48 B 4 B
      Shape (6, 2) (1, 1)
      Dask graph 12 chunks in 18 graph layers
      Data type float32 numpy.ndarray
      2 6
    • frac_water
      (location, run_name)
      float32
      dask.array<chunksize=(1, 1), meta=np.ndarray>
      standard_name :
      water_fraction
      long_name :
      Water Fraction
      units :
      %
      Array Chunk
      Bytes 48 B 4 B
      Shape (6, 2) (1, 1)
      Dask graph 12 chunks in 18 graph layers
      Data type float32 numpy.ndarray
      2 6
    • frac_nature
      (location, run_name)
      float32
      dask.array<chunksize=(1, 1), meta=np.ndarray>
      standard_name :
      nature_fraction
      long_name :
      Nature Fraction
      units :
      %
      Array Chunk
      Bytes 48 B 4 B
      Shape (6, 2) (1, 1)
      Dask graph 12 chunks in 18 graph layers
      Data type float32 numpy.ndarray
      2 6
    • frac_sea
      (location, run_name)
      float32
      dask.array<chunksize=(1, 1), meta=np.ndarray>
      standard_name :
      sea_fraction
      long_name :
      Sea Fraction
      units :
      %
      Array Chunk
      Bytes 48 B 4 B
      Shape (6, 2) (1, 1)
      Dask graph 12 chunks in 18 graph layers
      Data type float32 numpy.ndarray
      2 6
    • time
      PandasIndex
      PandasIndex(DatetimeIndex(['2019-07-01 01:00:00', '2019-07-01 02:00:00',
                     '2019-07-01 03:00:00', '2019-07-01 04:00:00',
                     '2019-07-01 05:00:00', '2019-07-01 06:00:00',
                     '2019-07-01 07:00:00', '2019-07-01 08:00:00',
                     '2019-07-01 09:00:00', '2019-07-01 10:00:00',
                     ...
                     '2019-07-30 15:00:00', '2019-07-30 16:00:00',
                     '2019-07-30 17:00:00', '2019-07-30 18:00:00',
                     '2019-07-30 19:00:00', '2019-07-30 20:00:00',
                     '2019-07-30 21:00:00', '2019-07-30 22:00:00',
                     '2019-07-30 23:00:00', '2019-07-31 00:00:00'],
                    dtype='datetime64[ns]', name='time', length=720, freq=None))
    • run_name
      PandasIndex
      PandasIndex(Index(['baseline', 'initSFX'], dtype='object', name='run_name'))
    • location
      PandasIndex
      PandasIndex(Index(['Provinciehuis', 'Melle', 'Honda', 'Wondelgem', 'Plantentuin',
             'Sint-Bavo'],
            dtype='object', name='location'))
  • CDI :
    Climate Data Interface version 2.0.6 (https://mpimet.mpg.de/cdi)
    source :
    ALARO-1 (CY43T2) - SURFEX v8.0
    Conventions :
    CF-1.11
    activity_id :
    DD
    comment :
    contact :
    wout.dewettinck@ugent.be
    domain :
    domain_id :
    driving_experiment :
    reanalysis simulation of the recent past
    driving_experiment_id :
    evaluation
    driving_institution_id :
    ECMWF
    driving_source_id :
    ERA5
    driving_variant_label :
    r1i1p1f1
    grid :
    Lambert conic conformal with 1.3 km grid spacing
    history :
    Thu Nov 07 17:12:31 2024: cdo -v remapcon,/dodrio/scratch/users/vsc45263/wout/CompPhys/simulations/src/grids/belgium_5km_latlon.txt baseline_2019070100_720_hfls_2019-07-01T01_2019-07-31T00_3600.nc baseline_2019070100_720_hfls_2019-07-01T01_2019-07-31T00_3600_regridded.nc
    institution :
    institution_id :
    license :
    https://cordex.org/data-access/cordex-cmip6-data/cordex-cmip6-terms-of-use
    mip_era :
    CMIP6
    product :
    model-output
    project_id :
    CORDEX
    references :
    source_id :
    source_type :
    ARCM
    tracking_id :
    variable_id :
    hfls
    version_realization :
    v1-r1
    version_realization_info :
    creation_date :
    2024-11-07T16:08:42Z
    frequency :
    1hr
    StartTime :
    2019-07-01T00:00
    EndTime :
    2019-07-31T00:00
    CDO :
    Climate Data Operators version 2.0.6 (https://mpimet.mpg.de/cdo)
In [21]:
g = (ds_locations.tas - obs.tas).plot(x="time", hue="location", col="run_name")
No description has been provided for this image
In [22]:
(ds_locations.tas - obs.tas).mean(dim="time")
Out[22]:
<xarray.DataArray 'tas' (location: 6, run_name: 2)>
array([[-2.71403936,  1.04013443],
       [-2.01451111,  2.72074661],
       [-2.70597651,  1.06752533],
       [-2.02824748,  1.78207764],
       [-2.07626973,  2.05037593],
       [-2.49320602,  1.26096776]])
Coordinates:
  * run_name  (run_name) <U8 'baseline' 'initSFX'
  * location  (location) <U13 'Provinciehuis' 'Melle' ... 'Sint-Bavo'
    crs       int64 0
    rstart    <U10 '2019070100'
xarray.DataArray
'tas'
  • location: 6
  • run_name: 2
  • -2.714 1.04 -2.015 2.721 -2.706 ... 1.782 -2.076 2.05 -2.493 1.261
    array([[-2.71403936,  1.04013443],
           [-2.01451111,  2.72074661],
           [-2.70597651,  1.06752533],
           [-2.02824748,  1.78207764],
           [-2.07626973,  2.05037593],
           [-2.49320602,  1.26096776]])
    • run_name
      (run_name)
      <U8
      'baseline' 'initSFX'
      array(['baseline', 'initSFX'], dtype='<U8')
    • location
      (location)
      <U13
      'Provinciehuis' ... 'Sint-Bavo'
      array(['Provinciehuis', 'Melle', 'Honda', 'Wondelgem', 'Plantentuin',
             'Sint-Bavo'], dtype='<U13')
    • crs
      ()
      int64
      0
      grid_mapping_name :
      lambert_conformal_conic
      standard_parallel :
      [51.07 51.07]
      latitude_of_projection_origin :
      0.0
      longitude_of_central_meridian :
      3.6999999999999993
      earth_radius :
      6371229.0
      array(0, dtype=int64)
    • rstart
      ()
      <U10
      '2019070100'
      array('2019070100', dtype='<U10')
    • run_name
      PandasIndex
      PandasIndex(Index(['baseline', 'initSFX'], dtype='object', name='run_name'))
    • location
      PandasIndex
      PandasIndex(Index(['Provinciehuis', 'Melle', 'Honda', 'Wondelgem', 'Plantentuin',
             'Sint-Bavo'],
            dtype='object', name='location'))

The baseline simulation (with a cold start) has a significant cold bias between 2 and 3 degrees for all 6 MOCCA locations. The spun-up simulation has a warm bias between 1 and 2 degrees (with 2.7 degrees at one location). We can conclude that the simulation without spin-up performs best.

In [23]:
ds_vars = ds[var_name_list]
ds_vars_mean = ds_vars.mean(dim=["lat", "lon"])
da_vars = ds_vars.to_dataarray()
da_vars_mean = da_vars.mean(dim=["lat", "lon"])
da_vars_mean.plot(x="time", col="variable", hue="run_name", sharey=False)
Out[23]:
<xarray.plot.facetgrid.FacetGrid at 0x2007d7ea3d0>
No description has been provided for this image
In [24]:
da_vars_mean.diff("run_name").plot(x="time", col="variable", sharey=False)
Out[24]:
<xarray.plot.facetgrid.FacetGrid at 0x2007dc1e850>
No description has been provided for this image

We can conclude a lot from these plots: Firstly, from the soil moisture plot mrso, we can clearly see the effect of the spin-up on this variable. The simulation with a cold start first has to relax to a state with a drier soil, while the other simulation does not. This process is paired with a larger latent heat flux (because of the excess evaporation) in the cold start-simulation. This inhibits the surface from heating up in this simulation and cause the surface temperature to be colder. This, in turn, leads to a colder near-surface air temperature. The air temperature is higher in the spun-up simulation, because of the higher sensible heat flux.

Extra 1. Locations with a heatwave¶

This extra exercise concerns the definition of a heat wave, as employed by the Belgian Royal Meteorological Institute. There, a heat wave period is defined as a period when the maximum temperatures in Uccle reach at least 25 degrees for at least 5 consecutive days, with at least 30 degrees being reached on at least three days. Write an algorithm to automatically detect heatwaves based on daily maximum temperatures. It is best to write it in two steps: 1) Select all periods which have at least five consecutive days above 25°C. 2) Check which of these periods contain at least three days with a temperature above 30°C.

  • Apply this algorithm on the simulation dataset. How long is the longest heat wave in the simulation data?
  • Apply this to the CLIMATE-GRID dataset. How long are the heat waves in this dataset?
  • Compare observations and simulations. Create a basic contingency table classifying each day based on wheter or not it is a heatwave day in the simulation or CLIMATE-GRID dataset. This creates four (2 x 2) classes for the heatwave days. Calculate some scores to assess the performance of the simulation. You can find some inspiration here: confusion matrix

Solutions:¶

In [25]:
tasmax = ds.tas.coarsen(time=24).max().sel(run_name="initSFX")
tasmax
Out[25]:
<xarray.DataArray 'tas' (time: 30, lat: 70, lon: 75)>
array([[[25.344513 , 26.228485 , 26.43814  , ..., 26.685028 ,
         26.228271 , 25.911438 ],
        [25.327545 , 26.579681 , 26.267242 , ..., 26.57486  ,
         26.467194 , 26.08194  ],
        [25.145721 , 25.39862  , 25.296387 , ..., 26.598541 ,
         26.629486 , 26.144196 ],
        ...,
        [19.011017 , 18.744385 , 18.326813 , ..., 25.157135 ,
         25.05127  , 24.898499 ],
        [18.929688 , 18.476196 , 17.993011 , ..., 24.93164  ,
         24.849762 , 24.680176 ],
        [18.917053 , 18.592773 , 18.305603 , ..., 25.097015 ,
         25.10971  , 24.809204 ]],

       [[25.661865 , 26.288239 , 26.450531 , ..., 26.661896 ,
         26.13797  , 25.660461 ],
        [25.884705 , 26.703705 , 26.18988  , ..., 26.449005 ,
         26.208466 , 25.695862 ],
        [25.584503 , 25.837158 , 25.533722 , ..., 26.623474 ,
         26.312897 , 25.601593 ],
...
        [17.352875 , 17.28363  , 17.28888  , ..., 28.44345  ,
         28.165436 , 28.32669  ],
        [17.283539 , 17.244202 , 17.191223 , ..., 28.098969 ,
         27.94458  , 28.042175 ],
        [17.273651 , 17.172455 , 17.132965 , ..., 27.95758  ,
         28.212128 , 28.416473 ]],

       [[24.85791  , 25.386536 , 25.25064  , ..., 30.49591  ,
         30.424713 , 30.205353 ],
        [24.775818 , 25.44281  , 25.292236 , ..., 30.527893 ,
         30.454468 , 30.157837 ],
        [24.670593 , 24.933655 , 24.86905  , ..., 30.87912  ,
         30.629211 , 30.270233 ],
        ...,
        [17.623718 , 17.484985 , 17.434357 , ..., 32.848022 ,
         32.275574 , 32.063538 ],
        [17.582062 , 17.460419 , 17.404663 , ..., 32.539948 ,
         32.434814 , 32.065277 ],
        [17.556885 , 17.458588 , 17.365875 , ..., 32.92624  ,
         32.49704  , 31.671722 ]]], dtype=float32)
Coordinates:
  * time      (time) datetime64[ns] 2019-07-01T12:30:00 ... 2019-07-30T12:30:00
  * lon       (lon) float64 2.0 2.07 2.14 2.21 2.28 ... 6.9 6.97 7.04 7.11 7.18
  * lat       (lat) float64 49.0 49.05 49.09 49.13 ... 51.97 52.02 52.06 52.1
    crs       int64 0
    rstart    <U10 '2019070100'
    run_name  <U8 'initSFX'
Attributes:
    standard_name:  air_temperature
    long_name:      Near-Surface Air Temperature
    units:          °C
    cell_methods:   time: point
xarray.DataArray
'tas'
  • time: 30
  • lat: 70
  • lon: 75
  • 25.34 26.23 26.44 26.54 26.48 26.24 ... 32.32 32.91 32.93 32.5 31.67
    array([[[25.344513 , 26.228485 , 26.43814  , ..., 26.685028 ,
             26.228271 , 25.911438 ],
            [25.327545 , 26.579681 , 26.267242 , ..., 26.57486  ,
             26.467194 , 26.08194  ],
            [25.145721 , 25.39862  , 25.296387 , ..., 26.598541 ,
             26.629486 , 26.144196 ],
            ...,
            [19.011017 , 18.744385 , 18.326813 , ..., 25.157135 ,
             25.05127  , 24.898499 ],
            [18.929688 , 18.476196 , 17.993011 , ..., 24.93164  ,
             24.849762 , 24.680176 ],
            [18.917053 , 18.592773 , 18.305603 , ..., 25.097015 ,
             25.10971  , 24.809204 ]],
    
           [[25.661865 , 26.288239 , 26.450531 , ..., 26.661896 ,
             26.13797  , 25.660461 ],
            [25.884705 , 26.703705 , 26.18988  , ..., 26.449005 ,
             26.208466 , 25.695862 ],
            [25.584503 , 25.837158 , 25.533722 , ..., 26.623474 ,
             26.312897 , 25.601593 ],
    ...
            [17.352875 , 17.28363  , 17.28888  , ..., 28.44345  ,
             28.165436 , 28.32669  ],
            [17.283539 , 17.244202 , 17.191223 , ..., 28.098969 ,
             27.94458  , 28.042175 ],
            [17.273651 , 17.172455 , 17.132965 , ..., 27.95758  ,
             28.212128 , 28.416473 ]],
    
           [[24.85791  , 25.386536 , 25.25064  , ..., 30.49591  ,
             30.424713 , 30.205353 ],
            [24.775818 , 25.44281  , 25.292236 , ..., 30.527893 ,
             30.454468 , 30.157837 ],
            [24.670593 , 24.933655 , 24.86905  , ..., 30.87912  ,
             30.629211 , 30.270233 ],
            ...,
            [17.623718 , 17.484985 , 17.434357 , ..., 32.848022 ,
             32.275574 , 32.063538 ],
            [17.582062 , 17.460419 , 17.404663 , ..., 32.539948 ,
             32.434814 , 32.065277 ],
            [17.556885 , 17.458588 , 17.365875 , ..., 32.92624  ,
             32.49704  , 31.671722 ]]], dtype=float32)
    • time
      (time)
      datetime64[ns]
      2019-07-01T12:30:00 ... 2019-07-...
      axis :
      T
      standard_name :
      time
      long_name :
      time
      bounds :
      time_bnds
      array(['2019-07-01T12:30:00.000000000', '2019-07-02T12:30:00.000000000',
             '2019-07-03T12:30:00.000000000', '2019-07-04T12:30:00.000000000',
             '2019-07-05T12:30:00.000000000', '2019-07-06T12:30:00.000000000',
             '2019-07-07T12:30:00.000000000', '2019-07-08T12:30:00.000000000',
             '2019-07-09T12:30:00.000000000', '2019-07-10T12:30:00.000000000',
             '2019-07-11T12:30:00.000000000', '2019-07-12T12:30:00.000000000',
             '2019-07-13T12:30:00.000000000', '2019-07-14T12:30:00.000000000',
             '2019-07-15T12:30:00.000000000', '2019-07-16T12:30:00.000000000',
             '2019-07-17T12:30:00.000000000', '2019-07-18T12:30:00.000000000',
             '2019-07-19T12:30:00.000000000', '2019-07-20T12:30:00.000000000',
             '2019-07-21T12:30:00.000000000', '2019-07-22T12:30:00.000000000',
             '2019-07-23T12:30:00.000000000', '2019-07-24T12:30:00.000000000',
             '2019-07-25T12:30:00.000000000', '2019-07-26T12:30:00.000000000',
             '2019-07-27T12:30:00.000000000', '2019-07-28T12:30:00.000000000',
             '2019-07-29T12:30:00.000000000', '2019-07-30T12:30:00.000000000'],
            dtype='datetime64[ns]')
    • lon
      (lon)
      float64
      2.0 2.07 2.14 ... 7.04 7.11 7.18
      standard_name :
      longitude
      long_name :
      longitude
      units :
      degrees_east
      axis :
      X
      array([2.  , 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7 , 2.77,
             2.84, 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4 , 3.47, 3.54, 3.61,
             3.68, 3.75, 3.82, 3.89, 3.96, 4.03, 4.1 , 4.17, 4.24, 4.31, 4.38, 4.45,
             4.52, 4.59, 4.66, 4.73, 4.8 , 4.87, 4.94, 5.01, 5.08, 5.15, 5.22, 5.29,
             5.36, 5.43, 5.5 , 5.57, 5.64, 5.71, 5.78, 5.85, 5.92, 5.99, 6.06, 6.13,
             6.2 , 6.27, 6.34, 6.41, 6.48, 6.55, 6.62, 6.69, 6.76, 6.83, 6.9 , 6.97,
             7.04, 7.11, 7.18])
    • lat
      (lat)
      float64
      49.0 49.05 49.09 ... 52.06 52.1
      standard_name :
      latitude
      long_name :
      latitude
      units :
      degrees_north
      axis :
      Y
      array([49.   , 49.045, 49.09 , 49.135, 49.18 , 49.225, 49.27 , 49.315, 49.36 ,
             49.405, 49.45 , 49.495, 49.54 , 49.585, 49.63 , 49.675, 49.72 , 49.765,
             49.81 , 49.855, 49.9  , 49.945, 49.99 , 50.035, 50.08 , 50.125, 50.17 ,
             50.215, 50.26 , 50.305, 50.35 , 50.395, 50.44 , 50.485, 50.53 , 50.575,
             50.62 , 50.665, 50.71 , 50.755, 50.8  , 50.845, 50.89 , 50.935, 50.98 ,
             51.025, 51.07 , 51.115, 51.16 , 51.205, 51.25 , 51.295, 51.34 , 51.385,
             51.43 , 51.475, 51.52 , 51.565, 51.61 , 51.655, 51.7  , 51.745, 51.79 ,
             51.835, 51.88 , 51.925, 51.97 , 52.015, 52.06 , 52.105])
    • crs
      ()
      int64
      0
      grid_mapping_name :
      lambert_conformal_conic
      standard_parallel :
      [51.07 51.07]
      latitude_of_projection_origin :
      0.0
      longitude_of_central_meridian :
      3.6999999999999993
      earth_radius :
      6371229.0
      array(0, dtype=int64)
    • rstart
      ()
      <U10
      '2019070100'
      array('2019070100', dtype='<U10')
    • run_name
      ()
      <U8
      'initSFX'
      array('initSFX', dtype='<U8')
    • time
      PandasIndex
      PandasIndex(DatetimeIndex(['2019-07-01 12:30:00', '2019-07-02 12:30:00',
                     '2019-07-03 12:30:00', '2019-07-04 12:30:00',
                     '2019-07-05 12:30:00', '2019-07-06 12:30:00',
                     '2019-07-07 12:30:00', '2019-07-08 12:30:00',
                     '2019-07-09 12:30:00', '2019-07-10 12:30:00',
                     '2019-07-11 12:30:00', '2019-07-12 12:30:00',
                     '2019-07-13 12:30:00', '2019-07-14 12:30:00',
                     '2019-07-15 12:30:00', '2019-07-16 12:30:00',
                     '2019-07-17 12:30:00', '2019-07-18 12:30:00',
                     '2019-07-19 12:30:00', '2019-07-20 12:30:00',
                     '2019-07-21 12:30:00', '2019-07-22 12:30:00',
                     '2019-07-23 12:30:00', '2019-07-24 12:30:00',
                     '2019-07-25 12:30:00', '2019-07-26 12:30:00',
                     '2019-07-27 12:30:00', '2019-07-28 12:30:00',
                     '2019-07-29 12:30:00', '2019-07-30 12:30:00'],
                    dtype='datetime64[ns]', name='time', freq=None))
    • lon
      PandasIndex
      PandasIndex(Index([               2.0,               2.07,               2.14,
                           2.21, 2.2800000000000002,               2.35,
                           2.42,               2.49,               2.56,
                           2.63,                2.7,               2.77,
                           2.84,               2.91,               2.98,
             3.0500000000000003,               3.12,               3.19,
             3.2600000000000002,               3.33, 3.4000000000000004,
                           3.47,               3.54, 3.6100000000000003,
                           3.68,               3.75, 3.8200000000000003,
                           3.89,               3.96,               4.03,
             4.1000000000000005,               4.17,               4.24,
             4.3100000000000005,               4.38,               4.45,
             4.5200000000000005,               4.59,               4.66,
                           4.73,  4.800000000000001,               4.87,
                           4.94,  5.010000000000001,               5.08,
                           5.15,  5.220000000000001,               5.29,
                           5.36,  5.430000000000001,                5.5,
                           5.57,  5.640000000000001,               5.71,
                           5.78, 5.8500000000000005,               5.92,
                           5.99, 6.0600000000000005,  6.130000000000001,
                            6.2, 6.2700000000000005,  6.340000000000001,
                           6.41,               6.48,  6.550000000000001,
                           6.62,               6.69,  6.760000000000001,
                           6.83,                6.9,  6.970000000000001,
              7.040000000000001,               7.11,  7.180000000000001],
            dtype='float64', name='lon'))
    • lat
      PandasIndex
      PandasIndex(Index([  49.0, 49.045,  49.09, 49.135,  49.18, 49.225,  49.27, 49.315,  49.36,
             49.405,  49.45, 49.495,  49.54, 49.585,  49.63, 49.675,  49.72, 49.765,
              49.81, 49.855,   49.9, 49.945,  49.99, 50.035,  50.08, 50.125,  50.17,
             50.215,  50.26, 50.305,  50.35, 50.395,  50.44, 50.485,  50.53, 50.575,
              50.62, 50.665,  50.71, 50.755,   50.8, 50.845,  50.89, 50.935,  50.98,
             51.025,  51.07, 51.115,  51.16, 51.205,  51.25, 51.295,  51.34, 51.385,
              51.43, 51.475,  51.52, 51.565,  51.61, 51.655,   51.7, 51.745,  51.79,
             51.835,  51.88, 51.925,  51.97, 52.015,  52.06, 52.105],
            dtype='float64', name='lat'))
  • standard_name :
    air_temperature
    long_name :
    Near-Surface Air Temperature
    units :
    °C
    cell_methods :
    time: point
In [26]:
def calc_heatwave_days_point(tasmax_point):
    # Initialize a boolean array
    heatwave_days_point = np.zeros_like(tasmax_point, dtype=bool)

    # Identify days above 25°C (potential heatwave days)
    heatwave_start = tasmax_point > 25

    # Find transitions to and from heatwave periods
    transitions = np.diff(heatwave_start.astype(int))

    # Get start and stop indices of heatwaves
    start_list = np.where(transitions == 1)[0] + 1
    stop_list = np.where(transitions == -1)[0]

    # Handle the edge case where a heatwave starts but doesn't end
    if heatwave_start[0]:
        start_list = np.insert(start_list, 0, 0)
    if heatwave_start[-1]:
        stop_list = np.append(stop_list, len(tasmax_point) - 1)

    # Validate the start/stop pair lengths
    assert len(start_list) == len(stop_list)

    # Filter heatwaves: periods where >3 days exceed 30°C
    for start, stop in zip(start_list, stop_list):
        tasmax_period = tasmax_point[start:stop + 1]
        days_above_30 = (tasmax_period > 30).sum()
        if days_above_30 >= 3:
            heatwave_days_point[start:stop + 1] = True

    return heatwave_days_point
In [27]:
def calc_heatwave_days(tasmax):
    # Apply the function using xarray's apply_ufunc
    heatwave_days = xr.apply_ufunc(
        calc_heatwave_days_point,      # Function to apply
        tasmax,                        # Dataset
        input_core_dims=[["time"]],    # Apply along 'time'
        output_core_dims=[["time"]],
        vectorize=True,                # Vectorize over lat/lon
        output_dtypes=[bool],          # Output type
        dask="allowed",                # Enable Dask support if needed
    )

    return heatwave_days
In [28]:
heatwave_days = calc_heatwave_days(tasmax)
In [29]:
fig, ax = plt.subplots(subplot_kw={'projection': ccrs.PlateCarree()}, figsize=(9,6), layout="constrained")
heatwave_days.sum(dim="time").plot(x="lon", y="lat", ax=ax)
ax.set_aspect(14/9)
ax.coastlines()
ax.add_feature(cfeature.BORDERS, linestyle="--", alpha=0.5)
ax.set_title("Number of heatwave days in simulation");
No description has been provided for this image

Let's select one of the points with the most heatwave days

In [30]:
lat = 49
lon = 2.15
heatwave_days_point = heatwave_days.sel(lat=lat, lon=lon, method="nearest")
tasmax_point = tasmax.sel(lon=lon, lat=lat, method="nearest")

fig, ax = plt.subplots()
tasmax_point.plot(ax=ax)
tasmax_point.where(heatwave_days_point).plot.scatter(ax=ax, color="orange")
ax.axhline(25, linestyle="--", color="grey")
ax.axhline(30, linestyle="--", color="k")
ax.set_title(f"Temperature in {lat:.1f} N, {lon:.1f}");
No description has been provided for this image

Extra 2. Simulation without urban areas¶

The model which we have used for all simulations consists of an atmospheric part, ALARO, and a surface module, SURFEX. The interaction between the atmosphere and the surface is an important part of weather and climate modelling. These interactions depend heavily on the type of surface. SURFEX tackles this variety by considering four classes of surface: sea, (inland) water, town and nature. Based on an external dataset (ECOCLIMAP) every grid box of the model is assigned a certain fraction of each of these four classes. For example, for a model with a resolution of 4-km, we could find a grid box in a small town with 30 % town fraction and 70 % nature fraction. Also, a grid box containing a city by the coast could have a town fraction of 25 %, a nature fraction of 20 % and a sea fraction of 55 %. Note that the fractions for each grid box necessarily always sum to 100 %. Every part of the grid box is calculated separately by a sifferent sub-module, specific to the surface type. The output of these calculations (for example the near-surface air temperature) are then aggregated for the whole grid box, by taking a weighted average, with the land use fractions taken as weights.

We will now invesigate a simulation where we made some changes to the land use. For this simulation, we have taken every urban area and put it equal to rock. Normally, urban areas are calculated by the TEB (Town Energy Balance)-module, therefore we denote this simulation by noTEB. Explore this simulation by following the next steps:

  • Load in the tas (near-surface air temperature) data for the simulations initSFX (with towns) and initSFXnoTEB (without towns) for the simualtion starting on 1 July 2019 (720 hours). Select the period of the heat wave: 22 until 26 July 2019.
  • Load in the land_use data for both simulations. Plot all fractions for both simulations and verify the differences are as expected.
  • Select only the data from points which have a town fraction higher than 20 % in the initSFX-simulations. Select these points for both simulations. In the initSFXnoTEB-simulation these points will have a 0 % town fraction.
  • Calculate the average diurnal cycle of the temperature averaged over all points for both simulations. The average diurnal (or daily) cycle is calculated by taking the average of a variable for each hour of the day. The groupby-function from xarray will prove useful for this part.
  • Compare the diurnal cycles for both simulations. What do you see? Plot the difference between both cycles. When is the difference largest?

Solutions:¶

In [ ]:
var_name_list = ["tas"]
run_name_list = ["initSFX", "initSFXnoTEB"]
ds = open_data(data_dir, var_name_list, run_name_list)
ds
In [ ]:
ds_land_use = ds[["frac_town", "frac_nature", "frac_sea", "frac_water"]]
ds_land_use.to_dataarray().plot(row="run_name", col="variable")
plt.show()
/data/gent/452/vsc45263/scicomp/venvs/3.11.5-GCCcore-13.2.0/cascadelake-ampere-ib/lib/python3.11/site-packages/xarray/plot/facetgrid.py:676: UserWarning: The figure layout has changed to tight
  self.fig.tight_layout()
No description has been provided for this image

Only the town and nature fractions differ between both simulations. The town fraction is zero as expected in initSFXnoTEB.

In [ ]:
frac_town = ds_land_use.frac_town.sel(run_name="initSFX")
town_mask = frac_town > 0.2

fig, ax = plt.subplots(subplot_kw={'projection': ccrs.PlateCarree()})
town_mask.plot(ax=ax)
ax.set_title("All points with a town fraction above 20 %")
ax.set_aspect(14/9)
ax.coastlines()
ax.add_feature(cfeature.BORDERS, linestyle="--", alpha=0.5)
Out[ ]:
<cartopy.mpl.feature_artist.FeatureArtist at 0x149ec41bc090>
No description has been provided for this image
In [ ]:
tstart = "2019-07-22T01"
tstop = "2019-07-27T00"

ds_period = ds.sel(time=slice(tstart, tstop))
tas_period = ds_period.tas
tas_period_town_mask = tas_period.where(town_mask)
tas_period_town_mask_diurnal_cycle = tas_period_town_mask.groupby("time.hour").mean()

tas_dc = tas_period_town_mask_diurnal_cycle.mean(dim=["lat", "lon"])
tas_nature_dc = tas_dc.sel(run_name="initSFXnoTEB")
tas_town_dc = tas_dc.sel(run_name="initSFX")

fig, ax = plt.subplots()
(tas_town_dc - tas_nature_dc).plot(ax=ax, x="hour", label="TEB - noTEB")
ax.legend()
ax.set_title("Diurnal cycle of difference in temperature\nin urban points")
Out[ ]:
Text(0.5, 1.0, 'Diurnal cycle of difference in temperature\nin urban points')
No description has been provided for this image